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 void
doStart()
protected void
doStop()
org.apache.camel.CamelContext
getCamelContext()
protected void
manageObject(Object me)
Strategy for managing the objectvoid
onComponentAdd(String name, org.apache.camel.Component component)
void
onComponentRemove(String name, org.apache.camel.Component component)
void
onContextStarting(org.apache.camel.CamelContext context)
void
onContextStopped(org.apache.camel.CamelContext context)
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 aManagedEndpoint
and register that with the mbean server.void
onEndpointRemove(org.apache.camel.Endpoint endpoint)
void
onRouteContextCreate(org.apache.camel.Route route)
void
onRoutesAdd(Collection<org.apache.camel.Route> routes)
void
onRoutesRemove(Collection<org.apache.camel.Route> routes)
void
onServiceAdd(org.apache.camel.CamelContext context, org.apache.camel.Service service, org.apache.camel.Route route)
void
onServiceRemove(org.apache.camel.CamelContext context, org.apache.camel.Service service, org.apache.camel.Route route)
void
onThreadPoolAdd(org.apache.camel.CamelContext camelContext, ThreadPoolExecutor threadPool, String id, String sourceId, String routeId, String threadPoolProfileId)
void
onThreadPoolRemove(org.apache.camel.CamelContext camelContext, ThreadPoolExecutor threadPool)
protected boolean
registerProcessor(org.apache.camel.model.ProcessorDefinition<?> processor)
Should the given processor be registered.void
setCamelContext(org.apache.camel.CamelContext camelContext)
protected boolean
shouldRegister(Object service, org.apache.camel.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.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:
getCamelContext
in interfaceorg.apache.camel.CamelContextAware
-
setCamelContext
public void setCamelContext(org.apache.camel.CamelContext camelContext)
- Specified by:
setCamelContext
in interfaceorg.apache.camel.CamelContextAware
-
onContextStarting
public void onContextStarting(org.apache.camel.CamelContext context) throws org.apache.camel.VetoCamelContextStartException
- Specified by:
onContextStarting
in interfaceorg.apache.camel.spi.LifecycleStrategy
- Throws:
org.apache.camel.VetoCamelContextStartException
-
onContextStopped
public void onContextStopped(org.apache.camel.CamelContext context)
- Specified by:
onContextStopped
in interfaceorg.apache.camel.spi.LifecycleStrategy
-
onComponentAdd
public void onComponentAdd(String name, org.apache.camel.Component component)
- Specified by:
onComponentAdd
in interfaceorg.apache.camel.spi.LifecycleStrategy
-
onComponentRemove
public void onComponentRemove(String name, org.apache.camel.Component component)
- Specified by:
onComponentRemove
in 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 aManagedEndpoint
and register that with the mbean server.- Specified by:
onEndpointAdd
in interfaceorg.apache.camel.spi.LifecycleStrategy
- Parameters:
endpoint
- the Endpoint attempted to be added
-
onEndpointRemove
public void onEndpointRemove(org.apache.camel.Endpoint endpoint)
- Specified by:
onEndpointRemove
in 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:
onServiceAdd
in 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:
onServiceRemove
in interfaceorg.apache.camel.spi.LifecycleStrategy
-
onRoutesAdd
public void onRoutesAdd(Collection<org.apache.camel.Route> routes)
- Specified by:
onRoutesAdd
in interfaceorg.apache.camel.spi.LifecycleStrategy
-
onRoutesRemove
public void onRoutesRemove(Collection<org.apache.camel.Route> routes)
- Specified by:
onRoutesRemove
in 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:
onThreadPoolAdd
in interfaceorg.apache.camel.spi.LifecycleStrategy
-
onThreadPoolRemove
public void onThreadPoolRemove(org.apache.camel.CamelContext camelContext, ThreadPoolExecutor threadPool)
- Specified by:
onThreadPoolRemove
in interfaceorg.apache.camel.spi.LifecycleStrategy
-
onRouteContextCreate
public void onRouteContextCreate(org.apache.camel.Route route)
- Specified by:
onRouteContextCreate
in 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. TheManagementAgent
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.- 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:
doStart
in classorg.apache.camel.support.service.BaseService
- Throws:
Exception
-
-