- java.lang.Object
-
- javax.management.remote.rmi.RMIConnector
-
- All Implemented Interfaces:
Closeable,Serializable,AutoCloseable,JMXAddressable,JMXConnector
public class RMIConnector extends Object implements JMXConnector, Serializable, JMXAddressable
A connection to a remote RMI connector. Usually, such connections are made using
JMXConnectorFactory. However, specialized applications can use this class directly, for example with anRMIServerstub obtained without going through JNDI.- Since:
- 1.5
- See Also:
- Serialized Form
-
-
Field Summary
-
Fields declared in interface javax.management.remote.JMXConnector
CREDENTIALS
-
-
Constructor Summary
Constructors Constructor Description RMIConnector(JMXServiceURL url, Map<String,?> environment)Constructs anRMIConnectorthat will connect the RMI connector server with the given address.RMIConnector(RMIServer rmiServer, Map<String,?> environment)Constructs anRMIConnectorusing the given RMI stub.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidconnect()Establishes the connection to the connector server.voidconnect(Map<String,?> environment)Establishes the connection to the connector server.JMXServiceURLgetAddress()The address of this connector.StringtoString()Returns a string representation of this object.-
Methods declared in class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods declared in interface javax.management.remote.JMXConnector
addConnectionNotificationListener, close, getConnectionId, getMBeanServerConnection, getMBeanServerConnection, removeConnectionNotificationListener, removeConnectionNotificationListener
-
-
-
-
Constructor Detail
-
RMIConnector
public RMIConnector(JMXServiceURL url, Map<String,?> environment)
Constructs an
RMIConnectorthat will connect the RMI connector server with the given address.The address can refer directly to the connector server, using the following syntax:
service:jmx:rmi://[host[:port]]/stub/encoded-stub
(Here, the square brackets
[]are not part of the address but indicate that the host and port are optional.)The address can instead indicate where to find an RMI stub through JNDI, using the following syntax:
service:jmx:rmi://[host[:port]]/jndi/jndi-name
An implementation may also recognize additional address syntaxes, for example:
service:jmx:iiop://[host[:port]]/stub/encoded-stub
- Parameters:
url- the address of the RMI connector server.environment- additional attributes specifying how to make the connection. For JNDI-based addresses, these attributes can usefully include JNDI attributes recognized byInitialContext. This parameter can be null, which is equivalent to an empty Map.- Throws:
IllegalArgumentException- ifurlis null.
-
RMIConnector
public RMIConnector(RMIServer rmiServer, Map<String,?> environment)
Constructs an
RMIConnectorusing the given RMI stub.- Parameters:
rmiServer- an RMI stub representing the RMI connector server.environment- additional attributes specifying how to make the connection. This parameter can be null, which is equivalent to an empty Map.- Throws:
IllegalArgumentException- ifrmiServeris null.
-
-
Method Detail
-
toString
public String toString()
Returns a string representation of this object. In general, the
toStringmethod returns a string that "textually represents" this object. The result should be a concise but informative representation that is easy for a person to read.
-
getAddress
public JMXServiceURL getAddress()
The address of this connector.
- Specified by:
getAddressin interfaceJMXAddressable- Returns:
- the address of this connector, or null if it does not have one.
- Since:
- 1.6
-
connect
public void connect() throws IOExceptionDescription copied from interface:JMXConnectorEstablishes the connection to the connector server. This method is equivalent to
connect(null).- Specified by:
connectin interfaceJMXConnector- Throws:
IOException- if the connection could not be made because of a communication problem
-
connect
public void connect(Map<String,?> environment) throws IOException
Description copied from interface:JMXConnectorEstablishes the connection to the connector server.
If
connecthas already been called successfully on this object, calling it again has no effect. If, however,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.- Specified by:
connectin interfaceJMXConnector- Parameters:
environment- the properties of the connection. Properties in this map override properties in the map specified when theJMXConnectorwas created, if any. This parameter can be null, which is equivalent to an empty map.- Throws:
IOException- if the connection could not be made because of a communication problem
-
-