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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voiddoStart()protected voiddoStop()org.apache.camel.CamelContextprotected 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 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, suspendMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.camel.spi.LifecycleStrategy
onContextInitialized, onContextInitializing, onContextStarted, onContextStopping, onDataFormatCreated, onLanguageCreatedMethods inherited from interface org.apache.camel.Service
build, close, init, start, stopMethods inherited from interface org.apache.camel.ShutdownableService
shutdownMethods inherited from interface org.apache.camel.StatefulService
getStatus, isRunAllowed, isStarted, isStarting, isStopped, isStopping, isSuspendingMethods inherited from interface org.apache.camel.SuspendableService
isSuspended, resume, suspend
-
Constructor Details
-
JmxManagementLifecycleStrategy
public JmxManagementLifecycleStrategy() -
JmxManagementLifecycleStrategy
-
-
Method Details
-
getCamelContext
- Specified by:
getCamelContextin interfaceorg.apache.camel.spi.HasCamelContext
-
setCamelContext
- 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
- Specified by:
onContextStoppedin interfaceorg.apache.camel.spi.LifecycleStrategy
-
onComponentAdd
- Specified by:
onComponentAddin interfaceorg.apache.camel.spi.LifecycleStrategy
-
onComponentRemove
- Specified by:
onComponentRemovein 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 aManagedEndpointand register that with the mbean server.- Specified by:
onEndpointAddin interfaceorg.apache.camel.spi.LifecycleStrategy- Parameters:
endpoint- the Endpoint attempted to be added
-
onEndpointRemove
- 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
- Specified by:
onRoutesAddin interfaceorg.apache.camel.spi.LifecycleStrategy
-
onRoutesRemove
- 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
- Specified by:
onRouteContextCreatein 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. 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
- Overrides:
doStartin classorg.apache.camel.support.service.BaseService- Throws:
Exception
-
doStop
- Overrides:
doStopin classorg.apache.camel.support.service.BaseService- Throws:
Exception
-