public class DefaultManagementAgent extends ServiceSupport implements ManagementAgent, CamelContextAware
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_CONNECTION_PORT |
static String |
DEFAULT_DOMAIN |
static String |
DEFAULT_HOST |
static int |
DEFAULT_REGISTRY_PORT |
static String |
DEFAULT_SERVICE_URL_PATH |
shutdown, shuttingdown, started, starting, stopped, stopping, suspended, suspending
Constructor and Description |
---|
DefaultManagementAgent() |
DefaultManagementAgent(CamelContext camelContext) |
Modifier and Type | Method and Description |
---|---|
protected void |
createJmxConnector(String host) |
protected void |
createMBeanServer() |
protected void |
doStart()
Implementations override this method to support customized start/stop.
|
protected void |
doStop()
Implementations override this method to support customized start/stop.
|
protected void |
finalizeSettings() |
protected MBeanServer |
findOrCreateMBeanServer() |
CamelContext |
getCamelContext()
Get the
CamelContext |
Integer |
getConnectorPort()
Gets the port clients must use to connect
|
Boolean |
getCreateConnector()
Whether connector is created, allowing clients to connect remotely
|
Boolean |
getEndpointRuntimeStatisticsEnabled()
Gets whether endpoint runtime statistics is enabled
|
Boolean |
getIncludeHostName()
Gets whether host name is included in MBean names.
|
Boolean |
getLoadStatisticsEnabled()
Gets whether load statistics is enabled
|
String |
getManagementNamePattern()
The naming pattern for creating the CamelContext management name.
|
Boolean |
getMask()
Whether to remove detected sensitive information (such as passwords) from MBean names and attributes.
|
String |
getMBeanObjectDomainName()
Get domain name for Camel MBeans.
|
MBeanServer |
getMBeanServer()
Get the MBeanServer which hosts managed objects.
|
String |
getMBeanServerDefaultDomain()
Gets the default domain on the MBean server
|
Boolean |
getOnlyRegisterProcessorWithCustomId()
Whether to only register processors which has a custom id assigned.
|
Boolean |
getRegisterAlways()
Whether to always register mbeans.
|
Boolean |
getRegisterNewRoutes()
Whether to register mbeans when starting a new route
This option is default true.
|
Integer |
getRegistryPort()
Gets the port used by
LocateRegistry . |
String |
getServiceUrlPath()
Gets the service url
|
ManagementStatisticsLevel |
getStatisticsLevel()
Gets the statistics level
|
Boolean |
getUseHostIPAddress()
Gets whether host IP Address to be used instead of host name.
|
Boolean |
getUsePlatformMBeanServer()
Whether to use the platform MBean Server.
|
boolean |
isRegistered(ObjectName name)
Is the given object registered
|
<T> T |
newProxyClient(ObjectName name,
Class<T> mbean)
Creates a new proxy client
|
void |
register(Object obj,
ObjectName name)
Registers object with management infrastructure with a specific name.
|
void |
register(Object obj,
ObjectName name,
boolean forceRegistration)
Registers object with management infrastructure with a specific name.
|
void |
setCamelContext(CamelContext camelContext)
Injects the
CamelContext |
void |
setConnectorPort(Integer port)
Sets the port clients must use to connect
|
void |
setCreateConnector(Boolean flag)
Whether connector should be created, allowing clients to connect remotely
|
void |
setEndpointRuntimeStatisticsEnabled(Boolean endpointRuntimeStatisticsEnabled)
Sets whether endpoint runtime statistics is enabled (gathers runtime usage of each incoming and outgoing endpoints).
|
void |
setIncludeHostName(Boolean includeHostName)
Sets whether to include host name in the
ManagementNamingStrategy . |
void |
setLoadStatisticsEnabled(Boolean loadStatisticsEnabled)
Sets whether load statistics is enabled (gathers load statistics using a background thread per CamelContext).
|
void |
setManagementNamePattern(String managementNamePattern)
The naming pattern for creating the CamelContext management name.
|
void |
setMask(Boolean mask)
Whether to remove detected sensitive information (such as passwords) from MBean names and attributes.
|
void |
setMBeanObjectDomainName(String domainName)
Sets the object domain name
|
void |
setMBeanServer(MBeanServer mbeanServer)
Sets a custom mbean server to use
|
void |
setMBeanServerDefaultDomain(String domain)
Sets the default domain on the MBean server
|
void |
setOnlyRegisterProcessorWithCustomId(Boolean onlyRegisterProcessorWithCustomId)
Whether to only register processors which has a custom id assigned.
|
void |
setRegisterAlways(Boolean registerAlways)
Whether to always register mbeans.
|
void |
setRegisterNewRoutes(Boolean registerNewRoutes)
Whether to register mbeans when starting a new route
This option is default true.
|
void |
setRegistryPort(Integer port)
Sets the port used by
LocateRegistry . |
void |
setServiceUrlPath(String url)
Sets the service url
|
void |
setStatisticsLevel(ManagementStatisticsLevel statisticsLevel)
Sets the statistics level
Default is
ManagementStatisticsLevel.Default
The level can be set to Extended to gather additional information |
void |
setUseHostIPAddress(Boolean useHostIPAddress)
Sets whether to use host IP Address
|
void |
setUsePlatformMBeanServer(Boolean flag)
Whether to use the platform MBean Server.
|
void |
unregister(ObjectName name)
Unregisters object based upon registered name
|
doResume, doShutdown, doSuspend, getStatus, getVersion, isRunAllowed, isStarted, isStarting, isStopped, isStopping, isStoppingOrStopped, isSuspended, isSuspending, isSuspendingOrSuspended, resume, shutdown, start, stop, suspend
public static final String DEFAULT_DOMAIN
public static final String DEFAULT_HOST
public static final int DEFAULT_REGISTRY_PORT
public static final int DEFAULT_CONNECTION_PORT
public static final String DEFAULT_SERVICE_URL_PATH
public DefaultManagementAgent()
public DefaultManagementAgent(CamelContext camelContext)
protected void finalizeSettings() throws Exception
Exception
public void setRegistryPort(Integer port)
ManagementAgent
LocateRegistry
.setRegistryPort
in interface ManagementAgent
port
- the portpublic Integer getRegistryPort()
ManagementAgent
LocateRegistry
.getRegistryPort
in interface ManagementAgent
public void setConnectorPort(Integer port)
ManagementAgent
setConnectorPort
in interface ManagementAgent
port
- the portpublic Integer getConnectorPort()
ManagementAgent
getConnectorPort
in interface ManagementAgent
public void setMBeanServerDefaultDomain(String domain)
ManagementAgent
setMBeanServerDefaultDomain
in interface ManagementAgent
domain
- the domainpublic String getMBeanServerDefaultDomain()
ManagementAgent
getMBeanServerDefaultDomain
in interface ManagementAgent
public void setMBeanObjectDomainName(String domainName)
ManagementAgent
setMBeanObjectDomainName
in interface ManagementAgent
domainName
- the object domain namepublic String getMBeanObjectDomainName()
ManagementAgent
getMBeanObjectDomainName
in interface ManagementAgent
public void setServiceUrlPath(String url)
ManagementAgent
setServiceUrlPath
in interface ManagementAgent
url
- the service urlpublic String getServiceUrlPath()
ManagementAgent
getServiceUrlPath
in interface ManagementAgent
public void setCreateConnector(Boolean flag)
ManagementAgent
setCreateConnector
in interface ManagementAgent
flag
- true to create connectorpublic Boolean getCreateConnector()
ManagementAgent
getCreateConnector
in interface ManagementAgent
public void setUsePlatformMBeanServer(Boolean flag)
ManagementAgent
setUsePlatformMBeanServer
in interface ManagementAgent
flag
- true to use platform MBean serverpublic Boolean getUsePlatformMBeanServer()
ManagementAgent
getUsePlatformMBeanServer
in interface ManagementAgent
public Boolean getOnlyRegisterProcessorWithCustomId()
ManagementAgent
getOnlyRegisterProcessorWithCustomId
in interface ManagementAgent
public void setOnlyRegisterProcessorWithCustomId(Boolean onlyRegisterProcessorWithCustomId)
ManagementAgent
setOnlyRegisterProcessorWithCustomId
in interface ManagementAgent
onlyRegisterProcessorWithCustomId
- true to only register if custom id has been assignedpublic void setMBeanServer(MBeanServer mbeanServer)
ManagementAgent
setMBeanServer
in interface ManagementAgent
mbeanServer
- the custom mbean serverpublic MBeanServer getMBeanServer()
ManagementAgent
getMBeanServer
in interface ManagementAgent
public Boolean getRegisterAlways()
ManagementAgent
getRegisterAlways
in interface ManagementAgent
public void setRegisterAlways(Boolean registerAlways)
ManagementAgent
setRegisterAlways
in interface ManagementAgent
registerAlways
- true to always registerpublic Boolean getRegisterNewRoutes()
ManagementAgent
getRegisterNewRoutes
in interface ManagementAgent
public void setRegisterNewRoutes(Boolean registerNewRoutes)
ManagementAgent
setRegisterNewRoutes
in interface ManagementAgent
registerNewRoutes
- true to register when starting a new routepublic Boolean getMask()
ManagementAgent
getMask
in interface ManagementAgent
public void setMask(Boolean mask)
ManagementAgent
setMask
in interface ManagementAgent
public Boolean getIncludeHostName()
ManagementAgent
getIncludeHostName
in interface ManagementAgent
public void setIncludeHostName(Boolean includeHostName)
ManagementAgent
ManagementNamingStrategy
.
By default this is turned off from Camel 2.13 onwards, but this option
can be set to true to include the hostname as Camel 2.12 or
older releases does.setIncludeHostName
in interface ManagementAgent
includeHostName
- true to include host name in the MBean names.public Boolean getUseHostIPAddress()
ManagementAgent
getUseHostIPAddress
in interface ManagementAgent
public void setUseHostIPAddress(Boolean useHostIPAddress)
ManagementAgent
setUseHostIPAddress
in interface ManagementAgent
useHostIPAddress
- true to use IP Address.public String getManagementNamePattern()
ManagementAgent
getManagementNamePattern
in interface ManagementAgent
public void setManagementNamePattern(String managementNamePattern)
ManagementAgent
setManagementNamePattern
in interface ManagementAgent
public Boolean getLoadStatisticsEnabled()
ManagementAgent
getLoadStatisticsEnabled
in interface ManagementAgent
public void setLoadStatisticsEnabled(Boolean loadStatisticsEnabled)
ManagementAgent
setLoadStatisticsEnabled
in interface ManagementAgent
loadStatisticsEnabled
- true to enable load statisticspublic Boolean getEndpointRuntimeStatisticsEnabled()
ManagementAgent
getEndpointRuntimeStatisticsEnabled
in interface ManagementAgent
public void setEndpointRuntimeStatisticsEnabled(Boolean endpointRuntimeStatisticsEnabled)
ManagementAgent
setEndpointRuntimeStatisticsEnabled
in interface ManagementAgent
endpointRuntimeStatisticsEnabled
- true to enable endpoint runtime statisticspublic ManagementStatisticsLevel getStatisticsLevel()
ManagementAgent
getStatisticsLevel
in interface ManagementAgent
public void setStatisticsLevel(ManagementStatisticsLevel statisticsLevel)
ManagementAgent
ManagementStatisticsLevel.Default
The level can be set to Extended to gather additional informationsetStatisticsLevel
in interface ManagementAgent
statisticsLevel
- the new levelpublic CamelContext getCamelContext()
CamelContextAware
CamelContext
getCamelContext
in interface CamelContextAware
public void setCamelContext(CamelContext camelContext)
CamelContextAware
CamelContext
setCamelContext
in interface CamelContextAware
camelContext
- the Camel contextpublic void register(Object obj, ObjectName name) throws JMException
ManagementAgent
register
in interface ManagementAgent
obj
- the object to registername
- the nameJMException
- is thrown if the registration failedpublic void register(Object obj, ObjectName name, boolean forceRegistration) throws JMException
ManagementAgent
register
in interface ManagementAgent
obj
- the object to registername
- the nameforceRegistration
- if set to true, then object will be registered despite
existing object is already registered with the name.JMException
- is thrown if the registration failedpublic void unregister(ObjectName name) throws JMException
ManagementAgent
unregister
in interface ManagementAgent
name
- the nameJMException
- is thrown if the unregistration failedpublic boolean isRegistered(ObjectName name)
ManagementAgent
isRegistered
in interface ManagementAgent
name
- the namepublic <T> T newProxyClient(ObjectName name, Class<T> mbean)
ManagementAgent
newProxyClient
in interface ManagementAgent
name
- the mbean namembean
- the client interface, such as from the org.apache.camel.api.management.mbean
package.protected void doStart() throws Exception
ServiceSupport
ServiceSupport.doStop()
for more details.doStart
in class ServiceSupport
Exception
ServiceSupport.doStop()
protected void doStop() throws Exception
ServiceSupport
ServiceSupport.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 ServiceSupport
Exception
ServiceSupport.doStart()
protected void createMBeanServer()
protected MBeanServer findOrCreateMBeanServer()
protected void createJmxConnector(String host) throws IOException
IOException
Apache Camel