public class MBeanServerHandler extends Object implements MBeanServerHandlerMBean, MBeanRegistration
OBJECT_NAME
Constructor and Description |
---|
MBeanServerHandler(Configuration pConfig,
LogHandler pLogHandler)
Create a new MBeanServer handler who is responsible for managing multiple intra VM
MBeanServer at once
An optional qualifier used for registering this object as an MBean is taken from the given configuration as well |
Modifier and Type | Method and Description |
---|---|
void |
destroy()
Unregister all previously registered MBean.
|
Object |
dispatchRequest(JsonRequestHandler pRequestHandler,
JmxRequest pJmxReq)
Dispatch a request to the MBeanServer which can handle it
|
MBeanServerExecutorLocal |
getMBeanServerManager()
Get the set of MBeanServers found
|
String |
getObjectName() |
ServerHandle |
getServerHandle()
Get information about the detected server this agent is running on.
|
static List<ServerDetector> |
lookupDetectors() |
String |
mBeanServersInfo()
Get a description of all MBeanServers found
|
void |
postDeregister() |
void |
postRegister(Boolean registrationDone) |
void |
preDeregister() |
ObjectName |
preRegister(MBeanServer server,
ObjectName name) |
ObjectName |
registerMBean(Object pMBean,
String... pOptionalName)
Register a MBean under a certain name to the platform MBeanServer
|
public MBeanServerHandler(Configuration pConfig, LogHandler pLogHandler)
MBeanServer
at once
An optional qualifier used for registering this object as an MBean is taken from the given configuration as wellpConfig
- configuration for this agent which is also given to the ServerHandle#postDetect()
method for
special initialization.pLogHandler
- log handler used for logging purposespublic Object dispatchRequest(JsonRequestHandler pRequestHandler, JmxRequest pJmxReq) throws InstanceNotFoundException, AttributeNotFoundException, ReflectionException, MBeanException, NotChangedException
pRequestHandler
- request handler to be called with an MBeanServerpJmxReq
- the request to dispatchInstanceNotFoundException
AttributeNotFoundException
ReflectionException
MBeanException
NotChangedException
public final ObjectName registerMBean(Object pMBean, String... pOptionalName) throws MalformedObjectNameException, NotCompliantMBeanException, InstanceAlreadyExistsException
pMBean
- MBean to registerpOptionalName
- optional name under which the bean should be registered. If not provided,
it depends on whether the MBean to register implements MBeanRegistration
or
not.MalformedObjectNameException
NotCompliantMBeanException
InstanceAlreadyExistsException
public final void destroy() throws JMException
JMException
- if an exception occurs during unregistrationpublic MBeanServerExecutorLocal getMBeanServerManager()
public ServerHandle getServerHandle()
null
if no server
could be detected.public static List<ServerDetector> lookupDetectors()
public String mBeanServersInfo()
mBeanServersInfo
in interface MBeanServerHandlerMBean
public ObjectName preRegister(MBeanServer server, ObjectName name) throws MalformedObjectNameException
preRegister
in interface MBeanRegistration
MalformedObjectNameException
public final String getObjectName()
public void postRegister(Boolean registrationDone)
postRegister
in interface MBeanRegistration
public void preDeregister()
preDeregister
in interface MBeanRegistration
public void postDeregister()
postDeregister
in interface MBeanRegistration
Copyright © 2021. All rights reserved.