spring-framework / org.springframework.jmx.support / MBeanServerFactoryBean

MBeanServerFactoryBean

open class MBeanServerFactoryBean : FactoryBean<MBeanServer>, InitializingBean, DisposableBean

FactoryBean that obtains an javax.management.MBeanServer reference through the standard JMX 1.2 javax.management.MBeanServerFactory API (which is available on JDK 1.5 or as part of a JMX 1.2 provider). Exposes the MBeanServer for bean references.

By default, MBeanServerFactoryBean will always create a new MBeanServer even if one is already running. To have the MBeanServerFactoryBean attempt to locate a running MBeanServer first, set the value of the "locateExistingServerIfPossible" property to "true".

Author
Rob Harrop

Author
Juergen Hoeller

Since
1.2

See Also
#setLocateExistingServerIfPossible#locateMBeanServerjavax.management.MBeanServerjavax.management.MBeanServerFactory#findMBeanServerjavax.management.MBeanServerFactory#createMBeanServerjavax.management.MBeanServerFactory#newMBeanServerMBeanServerConnectionFactoryBeanConnectorServerFactoryBean

Constructors

<init>

MBeanServerFactoryBean()

FactoryBean that obtains an javax.management.MBeanServer reference through the standard JMX 1.2 javax.management.MBeanServerFactory API (which is available on JDK 1.5 or as part of a JMX 1.2 provider). Exposes the MBeanServer for bean references.

By default, MBeanServerFactoryBean will always create a new MBeanServer even if one is already running. To have the MBeanServerFactoryBean attempt to locate a running MBeanServer first, set the value of the "locateExistingServerIfPossible" property to "true".

Functions

afterPropertiesSet

open fun afterPropertiesSet(): Unit

Creates the MBeanServer instance.

destroy

open fun destroy(): Unit

Unregisters the MBeanServer instance, if necessary.

getObject

open fun getObject(): MBeanServer

getObjectType

open fun getObjectType(): Class<out MBeanServer>

isSingleton

open fun isSingleton(): Boolean

setAgentId

open fun setAgentId(agentId: String): Unit

Set the agent id of the MBeanServer to locate.

Default is none. If specified, this will result in an automatic attempt being made to locate the attendant MBeanServer, and (importantly) if said MBeanServer cannot be located no attempt will be made to create a new MBeanServer (and an MBeanServerNotFoundException will be thrown at resolution time).

Specifying the empty String indicates the platform MBeanServer.

setDefaultDomain

open fun setDefaultDomain(defaultDomain: String): Unit

Set the default domain to be used by the MBeanServer, to be passed to MBeanServerFactory.createMBeanServer() or MBeanServerFactory.findMBeanServer().

Default is none.

setLocateExistingServerIfPossible

open fun setLocateExistingServerIfPossible(locateExistingServerIfPossible: Boolean): Unit

Set whether or not the MBeanServerFactoryBean should attempt to locate a running MBeanServer before creating one.

Default is false.

setRegisterWithFactory

open fun setRegisterWithFactory(registerWithFactory: Boolean): Unit

Set whether to register the MBeanServer with the MBeanServerFactory, making it available through MBeanServerFactory.findMBeanServer().