Package org.apache.camel.management
Class JmxManagementLifecycleStrategy
- java.lang.Object
-
- org.apache.camel.support.service.BaseService
-
- org.apache.camel.support.service.ServiceSupport
-
- org.apache.camel.management.JmxManagementLifecycleStrategy
-
- All Implemented Interfaces:
AutoCloseable,org.apache.camel.CamelContextAware,org.apache.camel.Service,org.apache.camel.ShutdownableService,org.apache.camel.spi.LifecycleStrategy,org.apache.camel.StatefulService,org.apache.camel.SuspendableService
- Direct Known Subclasses:
DefaultManagementLifecycleStrategy
public class JmxManagementLifecycleStrategy extends org.apache.camel.support.service.ServiceSupport implements org.apache.camel.spi.LifecycleStrategy, org.apache.camel.CamelContextAware
Default JMX managed lifecycle strategy that registered objects using the configuredManagementStrategy.- See Also:
ManagementStrategy
-
-
Constructor Summary
Constructors Constructor Description JmxManagementLifecycleStrategy()JmxManagementLifecycleStrategy(org.apache.camel.CamelContext camelContext)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voiddoStart()protected voiddoStop()org.apache.camel.CamelContextgetCamelContext()protected voidmanageObject(Object me)Strategy for managing the objectvoidonComponentAdd(String name, org.apache.camel.Component component)voidonComponentRemove(String name, org.apache.camel.Component component)voidonContextStarting(org.apache.camel.CamelContext context)voidonContextStopped(org.apache.camel.CamelContext context)voidonEndpointAdd(org.apache.camel.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 aManagedEndpointand register that with the mbean server.voidonEndpointRemove(org.apache.camel.Endpoint endpoint)voidonRouteContextCreate(org.apache.camel.Route route)voidonRoutesAdd(Collection<org.apache.camel.Route> routes)voidonRoutesRemove(Collection<org.apache.camel.Route> routes)voidonServiceAdd(org.apache.camel.CamelContext context, org.apache.camel.Service service, org.apache.camel.Route route)voidonServiceRemove(org.apache.camel.CamelContext context, org.apache.camel.Service service, org.apache.camel.Route route)voidonThreadPoolAdd(org.apache.camel.CamelContext camelContext, ThreadPoolExecutor threadPool, String id, String sourceId, String routeId, String threadPoolProfileId)voidonThreadPoolRemove(org.apache.camel.CamelContext camelContext, ThreadPoolExecutor threadPool)protected booleanregisterProcessor(org.apache.camel.model.ProcessorDefinition<?> processor)Should the given processor be registered.voidsetCamelContext(org.apache.camel.CamelContext camelContext)protected booleanshouldRegister(Object service, org.apache.camel.Route route)Whether or not to register the mbean.protected voidunmanageObject(Object me)Un-manages the object.-
Methods inherited from class org.apache.camel.support.service.BaseService
build, doBuild, doFail, doInit, doLifecycleChange, doResume, doShutdown, doSuspend, fail, getStatus, init, isBuild, isInit, isNew, isRunAllowed, isShutdown, isStarted, isStarting, isStartingOrStarted, isStopped, isStopping, isStoppingOrStopped, isSuspended, isSuspending, isSuspendingOrSuspended, resume, shutdown, start, stop, suspend
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.camel.spi.LifecycleStrategy
onContextInitialized, onContextInitializing, onContextStart, onContextStarted, onContextStop, onContextStopping, onDataFormatCreated, onLanguageCreated
-
-
-
-
Constructor Detail
-
JmxManagementLifecycleStrategy
public JmxManagementLifecycleStrategy()
-
JmxManagementLifecycleStrategy
public JmxManagementLifecycleStrategy(org.apache.camel.CamelContext camelContext)
-
-
Method Detail
-
getCamelContext
public org.apache.camel.CamelContext getCamelContext()
- Specified by:
getCamelContextin interfaceorg.apache.camel.CamelContextAware
-
setCamelContext
public void setCamelContext(org.apache.camel.CamelContext camelContext)
- Specified by:
setCamelContextin interfaceorg.apache.camel.CamelContextAware
-
onContextStarting
public void onContextStarting(org.apache.camel.CamelContext context) throws org.apache.camel.VetoCamelContextStartException
- Specified by:
onContextStartingin interfaceorg.apache.camel.spi.LifecycleStrategy- Throws:
org.apache.camel.VetoCamelContextStartException
-
onContextStopped
public void onContextStopped(org.apache.camel.CamelContext context)
- Specified by:
onContextStoppedin interfaceorg.apache.camel.spi.LifecycleStrategy
-
onComponentAdd
public void onComponentAdd(String name, org.apache.camel.Component component)
- Specified by:
onComponentAddin interfaceorg.apache.camel.spi.LifecycleStrategy
-
onComponentRemove
public void onComponentRemove(String name, org.apache.camel.Component component)
- Specified by:
onComponentRemovein interfaceorg.apache.camel.spi.LifecycleStrategy
-
onEndpointAdd
public void onEndpointAdd(org.apache.camel.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 aManagedEndpointand register that with the mbean server.- Specified by:
onEndpointAddin interfaceorg.apache.camel.spi.LifecycleStrategy- Parameters:
endpoint- the Endpoint attempted to be added
-
onEndpointRemove
public void onEndpointRemove(org.apache.camel.Endpoint endpoint)
- Specified by:
onEndpointRemovein interfaceorg.apache.camel.spi.LifecycleStrategy
-
onServiceAdd
public void onServiceAdd(org.apache.camel.CamelContext context, org.apache.camel.Service service, org.apache.camel.Route route)
- Specified by:
onServiceAddin interfaceorg.apache.camel.spi.LifecycleStrategy
-
onServiceRemove
public void onServiceRemove(org.apache.camel.CamelContext context, org.apache.camel.Service service, org.apache.camel.Route route)
- Specified by:
onServiceRemovein interfaceorg.apache.camel.spi.LifecycleStrategy
-
onRoutesAdd
public void onRoutesAdd(Collection<org.apache.camel.Route> routes)
- Specified by:
onRoutesAddin interfaceorg.apache.camel.spi.LifecycleStrategy
-
onRoutesRemove
public void onRoutesRemove(Collection<org.apache.camel.Route> routes)
- Specified by:
onRoutesRemovein interfaceorg.apache.camel.spi.LifecycleStrategy
-
onThreadPoolAdd
public void onThreadPoolAdd(org.apache.camel.CamelContext camelContext, ThreadPoolExecutor threadPool, String id, String sourceId, String routeId, String threadPoolProfileId)
- Specified by:
onThreadPoolAddin interfaceorg.apache.camel.spi.LifecycleStrategy
-
onThreadPoolRemove
public void onThreadPoolRemove(org.apache.camel.CamelContext camelContext, ThreadPoolExecutor threadPool)
- Specified by:
onThreadPoolRemovein interfaceorg.apache.camel.spi.LifecycleStrategy
-
onRouteContextCreate
public void onRouteContextCreate(org.apache.camel.Route route)
- Specified by:
onRouteContextCreatein interfaceorg.apache.camel.spi.LifecycleStrategy
-
registerProcessor
protected boolean registerProcessor(org.apache.camel.model.ProcessorDefinition<?> processor)
Should the given processor be registered.
-
manageObject
protected void manageObject(Object me) throws Exception
Strategy for managing the object- Parameters:
me- the managed object- Throws:
Exception- is thrown if error registering the object for management
-
unmanageObject
protected void unmanageObject(Object me) throws Exception
Un-manages the object.- Parameters:
me- the managed object- Throws:
Exception- is thrown if error unregistering the managed object
-
shouldRegister
protected boolean shouldRegister(Object service, org.apache.camel.Route route)
Whether or not to register the mbean. TheManagementAgenthas 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.- Parameters:
service- the object to registerroute- an optional route the mbean is associated with, can be null- Returns:
- true to register, false to skip registering
-
doStart
protected void doStart() throws Exception
- Overrides:
doStartin classorg.apache.camel.support.service.BaseService- Throws:
Exception
-
-