Package org.springframework.jmx.support
Class ConnectorServerFactoryBean
java.lang.Object
org.springframework.jmx.support.MBeanRegistrationSupport
org.springframework.jmx.support.ConnectorServerFactoryBean
- All Implemented Interfaces:
org.springframework.beans.factory.DisposableBean
,org.springframework.beans.factory.FactoryBean<JMXConnectorServer>
,org.springframework.beans.factory.InitializingBean
public class ConnectorServerFactoryBean
extends MBeanRegistrationSupport
implements org.springframework.beans.factory.FactoryBean<JMXConnectorServer>, org.springframework.beans.factory.InitializingBean, org.springframework.beans.factory.DisposableBean
FactoryBean
that creates a JSR-160 JMXConnectorServer
,
optionally registers it with the MBeanServer
, and then starts it.
The JMXConnectorServer
can be started in a separate thread by setting the
threaded
property to true
. You can configure this thread to be a
daemon thread by setting the daemon
property to true
.
The JMXConnectorServer
is correctly shut down when an instance of this
class is destroyed on shutdown of the containing ApplicationContext
.
- Since:
- 1.2
- Author:
- Rob Harrop, Juergen Hoeller
- See Also:
-
Field Summary
Fields inherited from class org.springframework.jmx.support.MBeanRegistrationSupport
logger, server
Fields inherited from interface org.springframework.beans.factory.FactoryBean
OBJECT_TYPE_ATTRIBUTE
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Start the connector server.void
destroy()
Stop theJMXConnectorServer
managed by an instance of this class.Class<? extends JMXConnectorServer>
boolean
void
setDaemon
(boolean daemon) Set whether any threads started for theJMXConnectorServer
should be started as daemon threads.void
setEnvironment
(Properties environment) Set the environment properties used to construct theJMXConnectorServer
asjava.util.Properties
(String key/value pairs).void
setEnvironmentMap
(Map<String, ?> environment) Set the environment properties used to construct theJMXConnector
as aMap
of String keys and arbitrary Object values.void
setForwarder
(MBeanServerForwarder forwarder) Set an MBeanServerForwarder to be applied to theJMXConnectorServer
.void
setObjectName
(Object objectName) Set theObjectName
used to register theJMXConnectorServer
itself with theMBeanServer
, asObjectName
instance or asString
.void
setServiceUrl
(String serviceUrl) Set the service URL for theJMXConnectorServer
.void
setThreaded
(boolean threaded) Set whether theJMXConnectorServer
should be started in a separate thread.Methods inherited from class org.springframework.jmx.support.MBeanRegistrationSupport
doRegister, doUnregister, getRegisteredObjectNames, getServer, onRegister, onRegister, onUnregister, setRegistrationPolicy, setServer, unregisterBeans
-
Field Details
-
DEFAULT_SERVICE_URL
The default service URL.- See Also:
-
-
Constructor Details
-
ConnectorServerFactoryBean
public ConnectorServerFactoryBean()
-
-
Method Details
-
setServiceUrl
Set the service URL for theJMXConnectorServer
. -
setEnvironment
Set the environment properties used to construct theJMXConnectorServer
asjava.util.Properties
(String key/value pairs). -
setEnvironmentMap
Set the environment properties used to construct theJMXConnector
as aMap
of String keys and arbitrary Object values. -
setForwarder
Set an MBeanServerForwarder to be applied to theJMXConnectorServer
. -
setObjectName
Set theObjectName
used to register theJMXConnectorServer
itself with theMBeanServer
, asObjectName
instance or asString
.- Throws:
MalformedObjectNameException
- if theObjectName
is malformed
-
setThreaded
public void setThreaded(boolean threaded) Set whether theJMXConnectorServer
should be started in a separate thread. -
setDaemon
public void setDaemon(boolean daemon) Set whether any threads started for theJMXConnectorServer
should be started as daemon threads. -
afterPropertiesSet
Start the connector server. If thethreaded
flag is set totrue
, theJMXConnectorServer
will be started in a separate thread. If thedaemon
flag is set totrue
, that thread will be started as a daemon thread.- Specified by:
afterPropertiesSet
in interfaceorg.springframework.beans.factory.InitializingBean
- Throws:
JMException
- if a problem occurred when registering the connector server with theMBeanServer
IOException
- if there is a problem starting the connector server
-
getObject
- Specified by:
getObject
in interfaceorg.springframework.beans.factory.FactoryBean<JMXConnectorServer>
-
getObjectType
- Specified by:
getObjectType
in interfaceorg.springframework.beans.factory.FactoryBean<JMXConnectorServer>
-
isSingleton
public boolean isSingleton()- Specified by:
isSingleton
in interfaceorg.springframework.beans.factory.FactoryBean<JMXConnectorServer>
-
destroy
Stop theJMXConnectorServer
managed by an instance of this class. Automatically called onApplicationContext
shutdown.- Specified by:
destroy
in interfaceorg.springframework.beans.factory.DisposableBean
- Throws:
IOException
- if there is an error stopping the connector server
-