Class: javax.management.remote.rmi.RMIConnectorServer
- public class RMIConnectorServer
- extends JMXConnectorServer
A JMX API connector server that creates RMI-based connections from remote clients. Usually, such connector servers are made using JMXConnectorServerFactory. However, specialized applications can use this class directly, for example with an javax.management.remote.rmi.RMIServerImpl object.
Inheritance
Superclass tree:- java.lang.Object
- javax.management.NotificationBroadcasterSupport
- javax.management.remote.JMXConnectorServer
- javax.management.remote.rmi.RMIConnectorServer
Methods
-
RMIConnectorServertop
Makes an
RMIConnectorServer. This is equivalent to calling RMIConnectorServer(directoryURL,environment,null,null) -
RMIConnectorServertop
public RMIConnectorServer(JMXServiceURL url, Map<?> environment, MBeanServer mbeanServer) throws IOExceptionMakes an
RMIConnectorServerfor the given MBean server. This is equivalent to calling RMIConnectorServer(directoryURL,environment,null,mbeanServer) -
RMIConnectorServertop
public RMIConnectorServer(JMXServiceURL url, Map<?> environment, RMIServerImpl rmiServerImpl, MBeanServer mbeanServer) throws IOExceptionMakes an
RMIConnectorServerfor the given 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.- Override hierarchy:
- connectionClosed from JMXConnectorServer
-
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.- Override hierarchy:
- connectionFailed from JMXConnectorServer
-
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.- Override hierarchy:
- connectionOpened from JMXConnectorServer
-
getAddresstop
public JMXServiceURL getAddress()The address of this connector server.
The address returned may not be the exact original javax.management.remote.JMXServiceURL that was supplied when creating the connector server, since the original address may not always be complete. For example the port number may be dynamically allocated when starting the connector server. Instead the address returned is the actual javax.management.remote.JMXServiceURL of the javax.management.remote.JMXConnectorServer. This is the address that clients supply to javax.management.remote.JMXConnectorFactory.connect(javax.management.remote.JMXServiceURL).
Note that the address returned may be null if the JMXConnectorServer is not yet active.
- Specified by:
- getAddress from JMXConnectorServerMBean
- getAddress from JMXAddressable
-
getAttributestop
public Map<?> getAttributes()The attributes for this connector server.
- Specified by:
- getAttributes from JMXConnectorServerMBean
-
isActivetop
public synchronized boolean isActive()- Specified by:
- isActive from JMXConnectorServerMBean
-
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
- Override hierarchy:
- setMBeanServerForwarder from JMXConnectorServer
-
starttop
public synchronized void start() throws IOExceptionActivates the connector server, that is starts listening for client connections. Calling this method when the connector server is already active has no effect. Calling this method when the connector server has been stopped will generate an
IOException.The behavior of this method when called for the first time depends on the parameters that were supplied at construction, as described below.
First, an object of a subclass of javax.management.remote.rmi.RMIServerImpl is required, to export the connector server through RMI:
- If an
RMIServerImplwas supplied to the constructor, it is used. - Otherwise, if the protocol part of the
JMXServiceURLsupplied to the constructor wasiiop, an object of type javax.management.remote.rmi.RMIIIOPServerImpl is created. - Otherwise, if the
JMXServiceURLwas null, or its protocol part wasrmi, an object of type javax.management.remote.rmi.RMIJRMPServerImpl is created. - Otherwise, the implementation can create an implementation-specific javax.management.remote.rmi.RMIServerImpl or it can throw java.net.MalformedURLException.
If the given address includes a JNDI directory URL as specified in the package documentation for javax.management.remote.rmi, then this
RMIConnectorServerwill bootstrap by binding theRMIServerImplto the given address.If the URL path part of the
JMXServiceURLwas empty or a single slash (/), then the RMI object will not be bound to a directory. Instead, a reference to it will be encoded in the URL path of the RMIConnectorServer address (returned by javax.management.remote.rmi.RMIConnectorServer.getAddress()). The encodings forrmiandiiopare described in the package documentation for javax.management.remote.rmi.The behavior when the URL path is neither empty nor a JNDI directory URL, or when the protocol is neither
rminoriiop, is implementation defined, and may include throwing java.net.MalformedURLException when the connector server is created or when it is started.- Specified by:
- start from JMXConnectorServerMBean
- If an
-
stoptop
public void stop() throws IOExceptionDeactivates the connector server, that is, stops listening for client connections. Calling this method will also close all client connections that were made by this server. After this method returns, whether normally or with an exception, the connector server will not create any new client connections.
Once a connector server has been stopped, it cannot be started again.
Calling this method when the connector server has already been stopped has no effect. Calling this method when the connector server has not yet been started will disable the connector server object permanently.
If closing a client connection produces an exception, that exception is not thrown from this method. A javax.management.remote.JMXConnectionNotification is emitted from this MBean with the connection ID of the connection that could not be closed.
Closing a connector server is a potentially slow operation. For example, if a client machine with an open connection 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.
This method calls the method close on the connector server's
RMIServerImplobject.If the
RMIServerImplwas bound to a JNDI directory by the start method, it is unbound from the directory by this method.- Specified by:
- stop 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.
- Specified by:
- toJMXConnector from JMXConnectorServerMBean
- Override hierarchy:
- toJMXConnector from JMXConnectorServer
Fields
-
JNDI_REBIND_ATTRIBUTE
public static final String JNDI_REBIND_ATTRIBUTE = "jmx.remote.jndi.rebind"Name of the attribute that specifies whether the javax.management.remote.rmi.RMIServer stub that represents an RMI connector server should override an existing stub at the same address. The value associated with this attribute, if any, should be a string that is equal, ignoring case, to
"true"or"false". The default value is false. -
RMI_CLIENT_SOCKET_FACTORY_ATTRIBUTE
public static final String RMI_CLIENT_SOCKET_FACTORY_ATTRIBUTE = "jmx.remote.rmi.client.socket.factory"Name of the attribute that specifies the java.rmi.server.RMIClientSocketFactory for the RMI objects created in conjunction with this connector. The value associated with this attribute must be of type
RMIClientSocketFactoryand can only be specified in theMapargument supplied when creating a connector server. -
RMI_SERVER_SOCKET_FACTORY_ATTRIBUTE
public static final String RMI_SERVER_SOCKET_FACTORY_ATTRIBUTE = "jmx.remote.rmi.server.socket.factory"Name of the attribute that specifies the java.rmi.server.RMIServerSocketFactory for the RMI objects created in conjunction with this connector. The value associated with this attribute must be of type
RMIServerSocketFactoryand can only be specified in theMapargument supplied when creating a connector server.
