Class ManagementContext
java.lang.Object
org.apache.activemq.broker.jmx.ManagementContext
- All Implemented Interfaces:
org.apache.activemq.Service
An abstraction over JMX MBean registration
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncreateCustomComponentMBeanName(String type, String name) Formulate and return the MBean ObjectName of a custom control MBeanprotected MBeanServerprotected MBeanServergetAttribute(ObjectName name, String attribute) Gets the broker name this context is used by, may be null if the broker name was not set.Get the connectorHostintGet the MBeanServergetObjectInstance(ObjectName name) intorg.apache.activemq.broker.SslContextGet the SSL context used for the JMX connector.static ObjectNamegetSystemObjectName(String domainName, String containerName, Class<?> theClass) Retrieve an System ObjectNameprotected booleanbooleanbooleanWhether the JMX connector server is bound and accepting connections.booleanbooleanbooleanbooleanbooleannewProxyInstance(ObjectName objectName, Class<?> interfaceClass, boolean notificationBroadcaster) queryNames(ObjectName name, QueryExp query) registerMBean(Object bean, ObjectName name) voidsetAllowRemoteAddressInMBeanNames(boolean allowRemoteAddressInMBeanNames) voidsetBrokerName(String brokerName) Sets the broker name this context is being used by.voidsetConnectorHost(String connectorHost) Set the connectorHostvoidsetConnectorPath(String connectorPath) voidsetConnectorPort(int connectorPort) voidsetCreateConnector(boolean createConnector) voidsetCreateMBeanServer(boolean enableJMX) voidsetEnvironment(Map<String, ?> environment) voidsetFindTigerMbeanServer(boolean findTigerMbeanServer) Enables/disables the searching for the Java 5 platform MBeanServervoidsetJmxDomainName(String jmxDomainName) voidsetMBeanServer(MBeanServer beanServer) Set the MBeanServervoidsetRmiServerPort(int rmiServerPort) voidsetSslContext(org.apache.activemq.broker.SslContext sslContext) Set the SSL context to use for the JMX connector.voidsetSuppressMBean(String commaListOfAttributeKeyValuePairs) Allow selective MBeans registration to be suppressed.voidsetUseMBeanServer(boolean useMBeanServer) voidstart()voidstop()voidunregisterMBean(ObjectName name) Unregister an MBean
-
Field Details
-
DEFAULT_DOMAIN
-
DEFAULT_LOOKUP_NAME
-
DEFAULT_CREATE_CONNECTOR
public static final boolean DEFAULT_CREATE_CONNECTOR
-
-
Constructor Details
-
ManagementContext
public ManagementContext() -
ManagementContext
-
-
Method Details
-
start
-
stop
-
getBrokerName
Gets the broker name this context is used by, may be null if the broker name was not set. -
setBrokerName
Sets the broker name this context is being used by. -
getJmxDomainName
- Returns:
- Returns the jmxDomainName.
-
setJmxDomainName
- Parameters:
jmxDomainName- The jmxDomainName to set.
-
getMBeanServer
-
setMBeanServer
Set the MBeanServer -
isUseMBeanServer
public boolean isUseMBeanServer()- Returns:
- Returns the useMBeanServer.
-
setUseMBeanServer
public void setUseMBeanServer(boolean useMBeanServer) - Parameters:
useMBeanServer- The useMBeanServer to set.
-
isCreateMBeanServer
public boolean isCreateMBeanServer()- Returns:
- Returns the createMBeanServer flag.
-
setCreateMBeanServer
public void setCreateMBeanServer(boolean enableJMX) - Parameters:
enableJMX- Set createMBeanServer.
-
isFindTigerMbeanServer
public boolean isFindTigerMbeanServer() -
isConnectorStarted
public boolean isConnectorStarted() -
isConnectorActive
public boolean isConnectorActive()Whether the JMX connector server is bound and accepting connections.isConnectorStarted()also reports true once a start attempt has failed, since it tracks that the attempt finished; this reports the outcome. -
setFindTigerMbeanServer
public void setFindTigerMbeanServer(boolean findTigerMbeanServer) Enables/disables the searching for the Java 5 platform MBeanServer -
createCustomComponentMBeanName
Formulate and return the MBean ObjectName of a custom control MBean- Returns:
- the JMX ObjectName of the MBean, or
nullifcustomNameis invalid.
-
getSystemObjectName
public static ObjectName getSystemObjectName(String domainName, String containerName, Class<?> theClass) throws MalformedObjectNameException, NullPointerException Retrieve an System ObjectName -
newProxyInstance
public Object newProxyInstance(ObjectName objectName, Class<?> interfaceClass, boolean notificationBroadcaster) -
getAttribute
- Throws:
Exception
-
registerMBean
- Throws:
Exception
-
isAllowedToRegister
-
queryNames
- Throws:
Exception
-
getObjectInstance
- Throws:
InstanceNotFoundException
-
unregisterMBean
Unregister an MBean- Throws:
JMException
-
findMBeanServer
-
findTigerMBeanServer
-
createMBeanServer
- Returns:
- an MBeanServer instance
- Throws:
MalformedObjectNameExceptionIOException
-
getConnectorPath
-
setConnectorPath
-
getConnectorPort
public int getConnectorPort() -
setConnectorPort
public void setConnectorPort(int connectorPort) -
getRmiServerPort
public int getRmiServerPort() -
setRmiServerPort
public void setRmiServerPort(int rmiServerPort) -
isCreateConnector
public boolean isCreateConnector() -
setCreateConnector
public void setCreateConnector(boolean createConnector) -
getConnectorHost
-
setConnectorHost
Set the connectorHost- Parameters:
connectorHost- the connectorHost to set
-
getEnvironment
-
setEnvironment
-
getSslContext
public org.apache.activemq.broker.SslContext getSslContext()Get the SSL context used for the JMX connector. -
setSslContext
public void setSslContext(org.apache.activemq.broker.SslContext sslContext) Set the SSL context to use for the JMX connector. When configured, the JMX RMI connector will use SSL with the keyStore and trustStore from this context, allowing reuse of the broker's<sslContext>configuration. The context is read once when the connector is created, soSslContext.reload()does not affect a running connector; restart the management context to pick up new key material. Example XML configuration, referring to ansslContextdeclared as a top level bean (anidon the broker's nested<sslContext>is not visible by reference):<amq:sslContext id="brokerSslContext" keyStore="broker.ks" .../> <broker sslContext="#brokerSslContext" ...> <managementContext> <managementContext createConnector="true" sslContext="#brokerSslContext"/> </managementContext> </broker>A nested<sslContext>element inside<managementContext>gives the JMX connector a context of its own instead. -
isAllowRemoteAddressInMBeanNames
public boolean isAllowRemoteAddressInMBeanNames() -
setAllowRemoteAddressInMBeanNames
public void setAllowRemoteAddressInMBeanNames(boolean allowRemoteAddressInMBeanNames) -
setSuppressMBean
Allow selective MBeans registration to be suppressed. Any Mbean ObjectName that matches any of the supplied attribute values will not be registered with the MBeanServer. eg: "endpoint=dynamicProducer,endpoint=Consumer" will suppress the registration of *all* dynamic producer and consumer mbeans.- Parameters:
commaListOfAttributeKeyValuePairs- the comma separated list of attribute key=value pairs to match.
-
getSuppressMBean
-