public class DefaultManagementStrategy extends ServiceSupport implements ManagementStrategy, CamelContextAware
ManagedManagementStrategy strategy. Then Camel will
fallback to use this instead that is basically a simple and noop strategy.
This class can also be used to extend your custom management implement. In fact the JMX capable
provided by Camel extends this class as well.ManagedManagementStrategyshutdown, shuttingdown, started, starting, stopped, stopping, suspended, suspending| Constructor and Description |
|---|
DefaultManagementStrategy() |
DefaultManagementStrategy(CamelContext camelContext) |
| Modifier and Type | Method and Description |
|---|---|
void |
addEventNotifier(EventNotifier eventNotifier)
Adds the event notifier to use.
|
Statistic |
createStatistic(String name,
Object owner,
Statistic.UpdateMode updateMode) |
protected void |
doStart()
Implementations override this method to support customized start/stop.
|
protected void |
doStartManagementStrategy() |
protected void |
doStop()
Implementations override this method to support customized start/stop.
|
CamelContext |
getCamelContext()
Get the
CamelContext |
EventFactory |
getEventFactory()
Gets the event factory
|
List<EventNotifier> |
getEventNotifiers()
Gets the event notifiers.
|
<T> T |
getManagedObjectName(Object managedObject,
String customName,
Class<T> nameType)
Construct an object name, where either the object to be managed and/or
a custom name component are provided
|
ManagementAgent |
getManagementAgent()
Gets the management agent
|
ManagementNamingStrategy |
getManagementNamingStrategy()
Gets the naming strategy to use
|
ManagementObjectStrategy |
getManagementObjectStrategy()
Gets the object strategy to use
|
ManagementStatisticsLevel |
getStatisticsLevel()
Gets the statistics level
|
boolean |
isLoadStatisticsEnabled()
Gets whether load statistics is enabled
|
boolean |
isManaged(Object managedObject,
Object name)
Determines if an object or name is managed.
|
boolean |
isOnlyManageProcessorWithCustomId()
Checks whether only to manage processors if they have been configured with a custom id
|
void |
manageNamedObject(Object managedObject,
Object preferredName)
Adds a managed object allowing the ManagementStrategy implementation
to record or expose the object as it sees fit.
|
void |
manageObject(Object managedObject)
Adds a managed object allowing the ManagementStrategy implementation to record or expose
the object as it sees fit.
|
boolean |
manageProcessor(ProcessorDefinition<?> definition)
Filter whether the processor should be managed or not.
|
void |
notify(EventObject event)
Management events provide a single model for capturing information about execution points in the
application code.
|
void |
onlyManageProcessorWithCustomId(boolean flag)
Sets the whether only manage processors if they have been configured with a custom id
Default is false.
|
boolean |
removeEventNotifier(EventNotifier eventNotifier)
Removes the event notifier
|
void |
setCamelContext(CamelContext camelContext)
Injects the
CamelContext |
void |
setEventFactory(EventFactory eventFactory)
Sets the event factory to use
|
void |
setEventNotifiers(List<EventNotifier> eventNotifiers)
Sets the list of event notifier to use.
|
void |
setLoadStatisticsEnabled(boolean loadStatisticsEnabled)
Sets whether load statistics is enabled.
|
void |
setManagementAgent(ManagementAgent managementAgent)
Sets the management agent to use
|
void |
setManagementNamingStrategy(ManagementNamingStrategy managementNamingStrategy)
Sets the naming strategy to use
|
void |
setManagementObjectStrategy(ManagementObjectStrategy managementObjectStrategy)
Sets the object strategy to use
|
void |
setStatisticsLevel(ManagementStatisticsLevel level)
Sets the statistics level
Default is
ManagementStatisticsLevel.All |
void |
unmanageNamedObject(Object name)
Removes a managed object by name.
|
void |
unmanageObject(Object managedObject)
Removes the managed object.
|
doResume, doShutdown, doSuspend, getStatus, getVersion, isRunAllowed, isStarted, isStarting, isStopped, isStopping, isStoppingOrStopped, isSuspended, isSuspending, isSuspendingOrSuspended, resume, shutdown, start, stop, suspendpublic DefaultManagementStrategy()
public DefaultManagementStrategy(CamelContext camelContext)
public List<EventNotifier> getEventNotifiers()
ManagementStrategygetEventNotifiers in interface ManagementStrategypublic void addEventNotifier(EventNotifier eventNotifier)
ManagementStrategyService, as otherwise
it would not be used.addEventNotifier in interface ManagementStrategyeventNotifier - event notifierpublic boolean removeEventNotifier(EventNotifier eventNotifier)
ManagementStrategyremoveEventNotifier in interface ManagementStrategyeventNotifier - event notifier to removepublic void setEventNotifiers(List<EventNotifier> eventNotifiers)
ManagementStrategysetEventNotifiers in interface ManagementStrategyeventNotifiers - list of event notifierspublic EventFactory getEventFactory()
ManagementStrategygetEventFactory in interface ManagementStrategypublic void setEventFactory(EventFactory eventFactory)
ManagementStrategysetEventFactory in interface ManagementStrategyeventFactory - event factorypublic ManagementNamingStrategy getManagementNamingStrategy()
ManagementStrategygetManagementNamingStrategy in interface ManagementStrategypublic void setManagementNamingStrategy(ManagementNamingStrategy managementNamingStrategy)
ManagementStrategysetManagementNamingStrategy in interface ManagementStrategymanagementNamingStrategy - naming strategypublic ManagementObjectStrategy getManagementObjectStrategy()
ManagementStrategygetManagementObjectStrategy in interface ManagementStrategypublic void setManagementObjectStrategy(ManagementObjectStrategy managementObjectStrategy)
ManagementStrategysetManagementObjectStrategy in interface ManagementStrategymanagementObjectStrategy - object strategypublic ManagementAgent getManagementAgent()
ManagementStrategygetManagementAgent in interface ManagementStrategypublic void setManagementAgent(ManagementAgent managementAgent)
ManagementStrategysetManagementAgent in interface ManagementStrategymanagementAgent - management agentpublic void onlyManageProcessorWithCustomId(boolean flag)
ManagementStrategyonlyManageProcessorWithCustomId in interface ManagementStrategyflag - true will only manage if custom id was set.public boolean isOnlyManageProcessorWithCustomId()
ManagementStrategyisOnlyManageProcessorWithCustomId in interface ManagementStrategypublic boolean manageProcessor(ProcessorDefinition<?> definition)
ManagementStrategymanageProcessor in interface ManagementStrategydefinition - definition of the processorpublic void manageObject(Object managedObject) throws Exception
ManagementStrategymanageObject in interface ManagementStrategymanagedObject - the managed objectException - can be thrown if the object could not be addedpublic void manageNamedObject(Object managedObject, Object preferredName) throws Exception
ManagementStrategymanageNamedObject in interface ManagementStrategymanagedObject - the managed objectpreferredName - representing the preferred name, maybe a String, or a JMX ObjectNameException - can be thrown if the object could not be addedpublic <T> T getManagedObjectName(Object managedObject, String customName, Class<T> nameType) throws Exception
ManagementStrategygetManagedObjectName in interface ManagementStrategymanagedObject - the object to be managedcustomName - a custom name componentnameType - the name type requiredException - can be thrown if the object name could not be createdpublic void unmanageObject(Object managedObject) throws Exception
ManagementStrategyunmanageObject in interface ManagementStrategymanagedObject - the managed objectException - can be thrown if the object could not be removedpublic void unmanageNamedObject(Object name) throws Exception
ManagementStrategyunmanageNamedObject in interface ManagementStrategyname - an object name previously created by this strategy.Exception - can be thrown if the object could not be removedpublic boolean isManaged(Object managedObject, Object name)
ManagementStrategyisManaged in interface ManagementStrategymanagedObject - the object to considername - the name to considerpublic CamelContext getCamelContext()
CamelContextAwareCamelContextgetCamelContext in interface CamelContextAwarepublic void setCamelContext(CamelContext camelContext)
CamelContextAwareCamelContextsetCamelContext in interface CamelContextAwarecamelContext - the Camel contextpublic void notify(EventObject event) throws Exception
ManagementStrategynotify in interface ManagementStrategyevent - the eventException - can be thrown if the notification failedpublic Statistic createStatistic(String name, Object owner, Statistic.UpdateMode updateMode)
public void setStatisticsLevel(ManagementStatisticsLevel level)
ManagementStrategyManagementStatisticsLevel.AllsetStatisticsLevel in interface ManagementStrategylevel - the new levelpublic ManagementStatisticsLevel getStatisticsLevel()
ManagementStrategygetStatisticsLevel in interface ManagementStrategypublic boolean isLoadStatisticsEnabled()
ManagementStrategyisLoadStatisticsEnabled in interface ManagementStrategypublic void setLoadStatisticsEnabled(boolean loadStatisticsEnabled)
ManagementStrategysetLoadStatisticsEnabled in interface ManagementStrategyloadStatisticsEnabled - true to enable load statisticsprotected void doStart()
throws Exception
ServiceSupportServiceSupport.doStop() for more details.doStart in class ServiceSupportExceptionServiceSupport.doStop()protected void doStartManagementStrategy()
throws Exception
Exceptionprotected void doStop()
throws Exception
ServiceSupportServiceSupport.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 ServiceSupportExceptionServiceSupport.doStart()Apache Camel