Class: javax.management.remote.JMXConnectorServer
- public abstract class JMXConnectorServer
- extends NotificationBroadcasterSupport
- implements JMXConnectorServerMBean, MBeanRegistration, JMXAddressable
Superclass of every connector server. A connector server is attached to an MBean server. It listens for client connection requests and creates a connection for each one.
A connector server is associated with an MBean server either by registering it in that MBean server, or by passing the MBean server to its constructor.
A connector server is inactive when created. It only starts listening for client connections when the start method is called. A connector server stops listening for client connections when the stop method is called or when the connector server is unregistered from its MBean server.
Stopping a connector server does not unregister it from its MBean server. A connector server once stopped cannot be restarted.
Each time a client connection is made or broken, a notification of class javax.management.remote.JMXConnectionNotification is emitted.
Inheritance
Superclass tree:- java.lang.Object
- javax.management.NotificationBroadcasterSupport
- javax.management.remote.JMXConnectorServer
Methods
-
JMXConnectorServertop
public JMXConnectorServer()Constructs a connector server that will be registered as an MBean in the MBean server it is attached to. This constructor is typically called by one of the
createMBeanmethods when creating, within an MBean server, a connector server that makes it available remotely. -
JMXConnectorServertop
public JMXConnectorServer(MBeanServer mbeanServer)Constructs a connector server that is attached to the given MBean server. A connector server that is created in this way can be registered in a different MBean server.
-
connectionClosedtop
Called by a subclass when a client connection is closed normally. Removes
connectionIdfrom the list returned by javax.management.remote.JMXConnectorServer.getConnectionIds(), then emits a javax.management.remote.JMXConnectionNotification with type javax.management.remote.JMXConnectionNotification.CLOSED. -
connectionFailedtop
Called by a subclass when a client connection fails. Removes
connectionIdfrom the list returned by javax.management.remote.JMXConnectorServer.getConnectionIds(), then emits a javax.management.remote.JMXConnectionNotification with type javax.management.remote.JMXConnectionNotification.FAILED. -
connectionOpenedtop
Called by a subclass when a new client connection is opened. Adds
connectionIdto the list returned by javax.management.remote.JMXConnectorServer.getConnectionIds(), then emits a javax.management.remote.JMXConnectionNotification with type javax.management.remote.JMXConnectionNotification.OPENED. -
getConnectionIdstop
public String[] getConnectionIds()The list of IDs for currently-open connections to this connector server.
- Specified by:
- getConnectionIds from JMXConnectorServerMBean
-
getMBeanServertop
public synchronized MBeanServer getMBeanServer()Returns the MBean server that this connector server is attached to.
-
getNotificationInfotop
public MBeanNotificationInfo[] getNotificationInfo()Returns an array indicating the notifications that this MBean sends. The implementation in
JMXConnectorServerreturns an array with one element, indicating that it can emit notifications of class javax.management.remote.JMXConnectionNotification with the types defined in that class. A subclass that can emit other notifications should return an array that contains this element plus descriptions of the other notifications.- Specified by:
- getNotificationInfo from NotificationBroadcaster
- Override hierarchy:
- getNotificationInfo from NotificationBroadcasterSupport
-
getNotificationSourcetop
synchronized private Object getNotificationSource() -
nextSequenceNumbertop
static private long nextSequenceNumber() -
postDeregistertop
public void postDeregister()Allows the MBean to perform any operations needed after having been unregistered in the MBean server.- Specified by:
- postDeregister from MBeanRegistration
-
postRegistertop
public void postRegister(Boolean registrationDone)Allows the MBean to perform any operations needed after having been registered in the MBean server or after the registration has failed.- Specified by:
- postRegister from MBeanRegistration
-
preDeregistertop
public synchronized void preDeregister() throws ExceptionCalled by an MBean server when this connector server is unregistered from that MBean server. If this connector server was attached to that MBean server by being registered in it, and if the connector server is still active, then unregistering it will call the stop method. If the
stopmethod throws an exception, the unregistration attempt will fail. It is recommended to call thestopmethod explicitly before unregistering the MBean.- Specified by:
- preDeregister from MBeanRegistration
-
preRegistertop
Called by an MBean server when this connector server is registered in that MBean server. This connector server becomes attached to the MBean server and its javax.management.remote.JMXConnectorServer.getMBeanServer() method will return
mbs.If this connector server is already attached to an MBean server, this method has no effect. The MBean server it is attached to is not necessarily the one it is being registered in.
- Specified by:
- preRegister from MBeanRegistration
-
sendNotificationtop
-
setMBeanServerForwardertop
public synchronized void setMBeanServerForwarder(MBeanServerForwarder mbsf)Adds an object that intercepts requests for the MBean server that arrive through this connector server. This object will be supplied as the
MBeanServerfor any new connection created by this connector server. Existing connections are unaffected.If this connector server is already associated with an
MBeanServerobject, then that object is given to mbsf.setMBeanServer. If doing so produces an exception, this method throws the same exception without any other effect.If this connector is not already associated with an
MBeanServerobject, or if thembsf.setMBeanServercall just mentioned succeeds, thenmbsfbecomes this connector server'sMBeanServer.- Specified by:
- setMBeanServerForwarder from JMXConnectorServerMBean
-
toJMXConnectortop
Returns a client stub for this connector server. A client stub is a serializable object whose connect method can be used to make one new connection to this connector server.
A given connector need not support the generation of client stubs. However, the connectors specified by the JMX Remote API do (JMXMP Connector and RMI Connector).
The default implementation of this method uses javax.management.remote.JMXConnectorServerMBean.getAddress() and javax.management.remote.JMXConnectorFactory to generate the stub, with code equivalent to the following:
JMXServiceURL addr = getAddress(); return JMXConnectorFactory.newJMXConnector(addr, env);
A connector server for which this is inappropriate must override this method so that it either implements the appropriate logic or throws UnsupportedOperationException.
- Specified by:
- toJMXConnector from JMXConnectorServerMBean
Fields
-
AUTHENTICATOR
public static final String AUTHENTICATOR = "jmx.remote.authenticator"Name of the attribute that specifies the authenticator for a connector server. The value associated with this attribute, if any, must be an object that implements the interface javax.management.remote.JMXAuthenticator.
-
connectionIds
-
mbeanServer
private MBeanServer mbeanServerThe MBeanServer used by this server to execute a client request. -
myName
private ObjectName myNameThe name used to registered this server in an MBeanServer. It is null if the this server is not registered or has been unregistered. -
sequenceNumber
static private long sequenceNumber -
sequenceNumberLock
static final private int[] sequenceNumberLock
