Interface: javax.management.remote.JMXConnector
- public interface JMXConnector
- implements Closeable
The client end of a JMX API connector. An object of this type can be used to establish a connection to a connector server.
A newly-created object of this type is unconnected. Its connect method must be called before it can be used. However, objects created by JMXConnectorFactory.connect are already connected.
Methods
-
addConnectionNotificationListenertop
public void addConnectionNotificationListener(NotificationListener listener, NotificationFilter filter, Object handback)Adds a listener to be informed of changes in connection status. The listener will receive notifications of type javax.management.remote.JMXConnectionNotification. An implementation can send other types of notifications too.
Any number of listeners can be added with this method. The same listener can be added more than once with the same or different values for the filter and handback. There is no special treatment of a duplicate entry. For example, if a listener is registered twice with no filter, then its
handleNotificationmethod will be called twice for each notification. -
closetop
public void close() throws IOExceptionCloses the client connection to its server. Any ongoing or new request using the MBeanServerConnection returned by javax.management.remote.JMXConnector.getMBeanServerConnection() will get an
IOException.If
closehas already been called successfully on this object, calling it again has no effect. Ifclosehas never been called, or if it was called but produced an exception, an attempt will be made to close the connection. This attempt can succeed, in which caseclosewill return normally, or it can generate an exception.Closing a connection is a potentially slow operation. For example, if the server has crashed, the close operation might have to wait for a network protocol timeout. Callers that do not want to block in a close operation should do it in a separate thread.
-
connecttop
public void connect() throws IOExceptionEstablishes the connection to the connector server. This method is equivalent to connect(null).
-
connecttop
public void connect(Map<?> env) throws IOExceptionEstablishes the connection to the connector server.
If
connecthas already been called successfully on this object, calling it again has no effect. If, however, javax.management.remote.JMXConnector.close() was called afterconnect, the newconnectwill throw anIOException.Otherwise, either
connecthas never been called on this object, or it has been called but produced an exception. Then callingconnectwill attempt to establish a connection to the connector server. -
getConnectionIdtop
public String getConnectionId() throws IOExceptionGets this connection's ID from the connector server. For a given connector server, every connection will have a unique id which does not change during the lifetime of the connection.
-
getMBeanServerConnectiontop
public MBeanServerConnection getMBeanServerConnection() throws IOExceptionReturns an
MBeanServerConnectionobject representing a remote MBean server. For a givenJMXConnector, two successful calls to this method will usually return the sameMBeanServerConnectionobject, though this is not required.For each method in the returned
MBeanServerConnection, calling the method causes the corresponding method to be called in the remote MBean server. The value returned by the MBean server method is the value returned to the client. If the MBean server method produces anException, the sameExceptionis seen by the client. If the MBean server method, or the attempt to call it, produces anError, theErroris wrapped in a javax.management.remote.JMXServerErrorException, which is seen by the client.Calling this method is equivalent to calling getMBeanServerConnection(null) meaning that no delegation subject is specified and that all the operations called on the
MBeanServerConnectionmust use the authenticated subject, if any. -
getMBeanServerConnectiontop
Returns an
MBeanServerConnectionobject representing a remote MBean server on which operations are performed on behalf of the supplied delegation subject. For a givenJMXConnectorandSubject, two successful calls to this method will usually return the sameMBeanServerConnectionobject, though this is not required.For each method in the returned
MBeanServerConnection, calling the method causes the corresponding method to be called in the remote MBean server on behalf of the given delegation subject instead of the authenticated subject. The value returned by the MBean server method is the value returned to the client. If the MBean server method produces anException, the sameExceptionis seen by the client. If the MBean server method, or the attempt to call it, produces anError, theErroris wrapped in a javax.management.remote.JMXServerErrorException, which is seen by the client. -
removeConnectionNotificationListenertop
public void removeConnectionNotificationListener(NotificationListener listener) throws ListenerNotFoundExceptionRemoves a listener from the list to be informed of changes in status. The listener must previously have been added. If there is more than one matching listener, all are removed.
-
removeConnectionNotificationListenertop
public void removeConnectionNotificationListener(NotificationListener l, NotificationFilter f, Object handback) throws ListenerNotFoundExceptionRemoves a listener from the list to be informed of changes in status. The listener must previously have been added with the same three parameters. If there is more than one matching listener, only one is removed.
Fields
-
CREDENTIALS
public static final String CREDENTIALS = "jmx.remote.credentials"Name of the attribute that specifies the credentials to send to the connector server during connection. The value associated with this attribute, if any, is a serializable object of an appropriate type for the server's javax.management.remote.JMXAuthenticator.
