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.HasCamelContext
,org.apache.camel.spi.LifecycleStrategy
,org.apache.camel.StatefulService
,org.apache.camel.SuspendableService
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 configured
ManagementStrategy
.- See Also:
-
Field Summary
Fields inherited from class org.apache.camel.support.service.BaseService
BUILT, FAILED, INITIALIZED, INITIALIZING, lock, NEW, SHUTDOWN, SHUTTING_DOWN, STARTED, STARTING, status, STOPPED, STOPPING, SUSPENDED, SUSPENDING
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected void
doStart()
protected void
doStop()
org.apache.camel.CamelContext
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 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, onContextStarted, onContextStopping, onDataFormatCreated, onLanguageCreated
Methods inherited from interface org.apache.camel.Service
build, close, init, start, stop
Methods inherited from interface org.apache.camel.ShutdownableService
shutdown
Methods inherited from interface org.apache.camel.StatefulService
getStatus, isRunAllowed, isStarted, isStarting, isStopped, isStopping, isSuspending
Methods inherited from interface org.apache.camel.SuspendableService
isSuspended, resume, suspend
-
Constructor Details
-
JmxManagementLifecycleStrategy
public JmxManagementLifecycleStrategy() -
JmxManagementLifecycleStrategy
-
-
Method Details
-
getCamelContext
- Specified by:
getCamelContext
in interfaceorg.apache.camel.spi.HasCamelContext
-
setCamelContext
- 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
- Specified by:
onContextStopped
in interfaceorg.apache.camel.spi.LifecycleStrategy
-
onComponentAdd
- Specified by:
onComponentAdd
in interfaceorg.apache.camel.spi.LifecycleStrategy
-
onComponentRemove
- Specified by:
onComponentRemove
in interfaceorg.apache.camel.spi.LifecycleStrategy
-
onEndpointAdd
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
- 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
- Specified by:
onRoutesAdd
in interfaceorg.apache.camel.spi.LifecycleStrategy
-
onRoutesRemove
- 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
- Specified by:
onRouteContextCreate
in interfaceorg.apache.camel.spi.LifecycleStrategy
-
registerProcessor
Should the given processor be registered. -
manageObject
Strategy for managing the object- Parameters:
me
- the managed object- Throws:
Exception
- is thrown if error registering the object for management
-
unmanageObject
Un-manages the object.- Parameters:
me
- the managed object- Throws:
Exception
- is thrown if error unregistering the managed object
-
shouldRegister
Whether 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
- Overrides:
doStart
in classorg.apache.camel.support.service.BaseService
- Throws:
Exception
-
doStop
- Overrides:
doStop
in classorg.apache.camel.support.service.BaseService
- Throws:
Exception
-