|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.camel.support.ServiceSupport org.apache.camel.management.DefaultManagementLifecycleStrategy
public class DefaultManagementLifecycleStrategy
Default JMX managed lifecycle strategy that registered objects using the configured
ManagementStrategy
.
ManagementStrategy
Field Summary |
---|
Fields inherited from class org.apache.camel.support.ServiceSupport |
---|
shutdown, shuttingdown, started, starting, stopped, stopping, suspended, suspending |
Constructor Summary | |
---|---|
DefaultManagementLifecycleStrategy()
|
|
DefaultManagementLifecycleStrategy(CamelContext camelContext)
|
Method Summary | |
---|---|
protected void |
doStart()
Implementations override this method to support customized start/stop. |
protected void |
doStop()
Implementations override this method to support customized start/stop. |
CamelContext |
getCamelContext()
Get the CamelContext |
protected void |
manageObject(Object me)
Strategy for managing the object |
void |
onComponentAdd(String name,
Component component)
Notification on adding an Component . |
void |
onComponentRemove(String name,
Component component)
Notification on removing an Component . |
void |
onContextStart(CamelContext context)
Notification on starting a CamelContext . |
void |
onContextStop(CamelContext context)
Notification on stopping a CamelContext . |
void |
onEndpointAdd(Endpoint endpoint)
If the endpoint is an instance of ManagedResource then register it with the mbean server, if it is not then wrap the endpoint in a ManagedEndpoint and
register that with the mbean server. |
void |
onEndpointRemove(Endpoint endpoint)
Notification on removing an Endpoint . |
void |
onErrorHandlerAdd(RouteContext routeContext,
Processor errorHandler,
ErrorHandlerFactory errorHandlerBuilder)
Notification on adding error handler. |
void |
onErrorHandlerRemove(RouteContext routeContext,
Processor errorHandler,
ErrorHandlerFactory errorHandlerBuilder)
Notification on removing error handler. |
void |
onRouteContextCreate(RouteContext routeContext)
Notification on adding RouteContext (s). |
void |
onRoutesAdd(Collection<Route> routes)
Notification on adding Route (s). |
void |
onRoutesRemove(Collection<Route> routes)
Notification on removing Route (s). |
void |
onServiceAdd(CamelContext context,
Service service,
Route route)
Notification on adding a Service . |
void |
onServiceRemove(CamelContext context,
Service service,
Route route)
Notification on removing a Service . |
void |
onThreadPoolAdd(CamelContext camelContext,
ThreadPoolExecutor threadPool,
String id,
String sourceId,
String routeId,
String threadPoolProfileId)
Notification on adding a thread pool. |
void |
onThreadPoolRemove(CamelContext camelContext,
ThreadPoolExecutor threadPool)
Notification on removing a thread pool. |
protected boolean |
registerProcessor(ProcessorDefinition<?> processor)
Should the given processor be registered. |
void |
setCamelContext(CamelContext camelContext)
Injects the CamelContext |
protected boolean |
shouldRegister(Object service,
Route route)
Whether or not to register the mbean. |
protected void |
unmanageObject(Object me)
Un-manages the object. |
Methods inherited from class org.apache.camel.support.ServiceSupport |
---|
doResume, doShutdown, doSuspend, getStatus, getVersion, isRunAllowed, isStarted, isStarting, isStopped, isStopping, isSuspended, isSuspending, resume, shutdown, start, stop, suspend |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public DefaultManagementLifecycleStrategy()
public DefaultManagementLifecycleStrategy(CamelContext camelContext)
Method Detail |
---|
public CamelContext getCamelContext()
CamelContextAware
CamelContext
getCamelContext
in interface CamelContextAware
public void setCamelContext(CamelContext camelContext)
CamelContextAware
CamelContext
setCamelContext
in interface CamelContextAware
camelContext
- the Camel contextpublic void onContextStart(CamelContext context) throws VetoCamelContextStartException
LifecycleStrategy
CamelContext
.
onContextStart
in interface LifecycleStrategy
context
- the camel context
VetoCamelContextStartException
- can be thrown to veto starting CamelContext
.
Any other runtime exceptions will be logged at WARN level by Camel will continue starting itself.public void onContextStop(CamelContext context)
LifecycleStrategy
CamelContext
.
onContextStop
in interface LifecycleStrategy
context
- the camel contextpublic void onComponentAdd(String name, Component component)
LifecycleStrategy
Component
.
onComponentAdd
in interface LifecycleStrategy
name
- the unique name of this componentcomponent
- the added componentpublic void onComponentRemove(String name, Component component)
LifecycleStrategy
Component
.
onComponentRemove
in interface LifecycleStrategy
name
- the unique name of this componentcomponent
- the removed componentpublic void onEndpointAdd(Endpoint endpoint)
ManagedEndpoint
and
register that with the mbean server.
onEndpointAdd
in interface LifecycleStrategy
endpoint
- the Endpoint attempted to be addedpublic void onEndpointRemove(Endpoint endpoint)
LifecycleStrategy
Endpoint
.
onEndpointRemove
in interface LifecycleStrategy
endpoint
- the removed endpointpublic void onServiceAdd(CamelContext context, Service service, Route route)
LifecycleStrategy
Service
.
onServiceAdd
in interface LifecycleStrategy
context
- the camel contextservice
- the added serviceroute
- the route the service belongs to if any possible to determinepublic void onServiceRemove(CamelContext context, Service service, Route route)
LifecycleStrategy
Service
.
onServiceRemove
in interface LifecycleStrategy
context
- the camel contextservice
- the removed serviceroute
- the route the service belongs to if any possible to determinepublic void onRoutesAdd(Collection<Route> routes)
LifecycleStrategy
Route
(s).
onRoutesAdd
in interface LifecycleStrategy
routes
- the added routespublic void onRoutesRemove(Collection<Route> routes)
LifecycleStrategy
Route
(s).
onRoutesRemove
in interface LifecycleStrategy
routes
- the removed routespublic void onErrorHandlerAdd(RouteContext routeContext, Processor errorHandler, ErrorHandlerFactory errorHandlerBuilder)
LifecycleStrategy
onErrorHandlerAdd
in interface LifecycleStrategy
routeContext
- the added route contexterrorHandler
- the error handlererrorHandlerBuilder
- the error handler builderpublic void onErrorHandlerRemove(RouteContext routeContext, Processor errorHandler, ErrorHandlerFactory errorHandlerBuilder)
LifecycleStrategy
onErrorHandlerRemove
in interface LifecycleStrategy
routeContext
- the removed route contexterrorHandler
- the error handlererrorHandlerBuilder
- the error handler builderpublic void onThreadPoolAdd(CamelContext camelContext, ThreadPoolExecutor threadPool, String id, String sourceId, String routeId, String threadPoolProfileId)
LifecycleStrategy
onThreadPoolAdd
in interface LifecycleStrategy
camelContext
- the camel contextthreadPool
- the thread poolid
- id of the thread pool (can be null in special cases)sourceId
- id of the source creating the thread pool (can be null in special cases)routeId
- id of the route for the source (is null if no source)threadPoolProfileId
- id of the thread pool profile, if used for creating this thread pool (can be null)public void onThreadPoolRemove(CamelContext camelContext, ThreadPoolExecutor threadPool)
LifecycleStrategy
onThreadPoolRemove
in interface LifecycleStrategy
camelContext
- the camel contextthreadPool
- the thread poolpublic void onRouteContextCreate(RouteContext routeContext)
LifecycleStrategy
RouteContext
(s).
onRouteContextCreate
in interface LifecycleStrategy
routeContext
- the added route contextprotected boolean registerProcessor(ProcessorDefinition<?> processor)
protected void manageObject(Object me) throws Exception
me
- the managed object
Exception
- is thrown if error registering the object for managementprotected void unmanageObject(Object me) throws Exception
me
- the managed object
Exception
- is thrown if error unregistering the managed objectprotected boolean shouldRegister(Object service, Route route)
ManagementAgent
has options which controls when to register.
This allows us to only register mbeans accordingly. For example by default any
dynamic endpoints is not registered. This avoids to register excessive mbeans, which
most often is not desired.
service
- the object to registerroute
- an optional route the mbean is associated with, can be null
protected void doStart() throws Exception
ServiceSupport
ServiceSupport.doStop()
for more details.
doStart
in class ServiceSupport
Exception
ServiceSupport.doStop()
protected void doStop() throws Exception
ServiceSupport
ServiceSupport.doStop()
method when
the service is being stopped. This method will also be invoked
if the service is still in uninitialized state (eg has not
been started). The method is always called to allow the service
to do custom logic when the service is being stopped, such as when
CamelContext
is shutting down.
doStop
in class ServiceSupport
Exception
ServiceSupport.doStart()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |