Class 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 an RMIServer stub obtained without going through JNDI.

Since:
1.5
See Also:
Serialized Form

Fields

Fields declared in interface javax.management.remote.JMXConnector

CREDENTIALS

Constructors

Constructor Description
RMIConnector​(JMXServiceURL url, Map<String,​?> environment)

Constructs an RMIConnector that will connect the RMI connector server with the given address.

RMIConnector​(RMIServer rmiServer, Map<String,​?> environment)

Constructs an RMIConnector using the given RMI stub.

Methods

Modifier and Type Method Description
void connect()

Establishes the connection to the connector server.

void connect​(Map<String,​?> environment)

Establishes the connection to the connector server.

JMXServiceURL getAddress()

The address of this connector.

String toString()

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

Constructors

RMIConnector

public RMIConnector(JMXServiceURL url,
                    Map<String,​?> environment)

Constructs an RMIConnector that 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 by InitialContext. This parameter can be null, which is equivalent to an empty Map.
Throws:
IllegalArgumentException - if url is null.

RMIConnector

public RMIConnector(RMIServer rmiServer,
                    Map<String,​?> environment)

Constructs an RMIConnector using 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 - if rmiServer is null.

Methods

toString

public String toString()

Returns a string representation of this object. In general, the toString method 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.

Overrides:
toString in class Object
Returns:
a String representation of this object.

getAddress

public JMXServiceURL getAddress()

The address of this connector.

Specified by:
getAddress in interface JMXAddressable
Returns:
the address of this connector, or null if it does not have one.
Since:
1.6

connect

public void connect()
             throws IOException

Description copied from interface: JMXConnector

Establishes the connection to the connector server. This method is equivalent to connect(null).

Specified by:
connect in interface JMXConnector
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: JMXConnector

Establishes the connection to the connector server.

If connect has already been called successfully on this object, calling it again has no effect. If, however, JMXConnector.close() was called after connect, the new connect will throw an IOException.

Otherwise, either connect has never been called on this object, or it has been called but produced an exception. Then calling connect will attempt to establish a connection to the connector server.

Specified by:
connect in interface JMXConnector
Parameters:
environment - the properties of the connection. Properties in this map override properties in the map specified when the JMXConnector was 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

© 1993, 2020, Oracle and/or its affiliates. All rights reserved.
Documentation extracted from Debian's OpenJDK Development Kit package.
Licensed under the GNU General Public License, version 2, with the Classpath Exception.
Various third party code in OpenJDK is licensed under different licenses (see Debian package).
Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
https://docs.oracle.com/en/java/javase/11/docs/api/java.management.rmi/javax/management/remote/rmi/RMIConnector.html