Class: javax.management.remote.rmi.RMIConnector

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 javax.management.remote.rmi.RMIServer stub obtained without going through JNDI.

Since:
@since 1.5

Inheritance

Superclass tree: Implements:

Methods

  • RMIConnectortop

    public RMIConnector(JMXServiceURL url, Map<?> 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 one of the following syntaxes:

     service:jmx:rmi://[host[:port]]/stub/encoded-stub
     service:jmx:iiop://[host[:port]]/ior/encoded-IOR
     

    (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 one of the following syntaxes:

     service:jmx:rmi://[host[:port]]/jndi/jndi-name
     service:jmx:iiop://[host[:port]]/jndi/jndi-name
     

    An implementation may also recognize additional address syntaxes, for example:

     service:jmx:iiop://[host[:port]]/stub/encoded-stub
     
    Parameters:
    @param url the address of the RMI connector server.
    @param 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.
    Exceptions:
    @exception IllegalArgumentException if url is null.
    Google Code Search
    Stack Overflow
  • RMIConnectortop

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

    Constructs an RMIConnector using the given RMI stub.

    Parameters:
    @param rmiServer an RMI stub representing the RMI connector server.
    @param environment additional attributes specifying how to make the connection. This parameter can be null, which is equivalent to an empty Map.
    Exceptions:
    @exception IllegalArgumentException if rmiServer is null.
    Google Code Search
    Stack Overflow
  • 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 handleNotification method will be called twice for each notification.

    Parameters:
    @param listener a listener to receive connection status notifications.
    @param filter a filter to select which notifications are to be delivered to the listener, or null if all notifications are to be delivered.
    @param handback an object to be given to the listener along with each notification. Can be null.
    Google Code Search
    Stack Overflow
  • closetop

    public synchronized void close() throws IOException

    Closes 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 close has already been called successfully on this object, calling it again has no effect. If close has 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 case close will 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.

    Exceptions:
    @exception IOException if the connection cannot be closed cleanly. If this exception is thrown, it is not known whether the server end of the connection has been cleanly closed.
    Specified by:
    close from JMXConnector
    close from Closeable
    Google Code Search
    Stack Overflow
  • connecttop

    public void connect() throws IOException

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

    Exceptions:
    @exception IOException if the connection could not be made because of a communication problem.
    Specified by:
    connect from JMXConnector
    Google Code Search
    Stack Overflow
  • connecttop

    public synchronized void connect(Map<?> environment) throws IOException

    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, javax.management.remote.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.

    Exceptions:
    @exception IOException if the connection could not be made because of a communication problem.
    Specified by:
    connect from JMXConnector
    Google Code Search
    Stack Overflow
  • getAddresstop

    public JMXServiceURL getAddress()

    The address of this connector.

    Return:
    @return the address of this connector, or null if it does not have one.
    Since:
    @since 1.6
    Specified by:
    getAddress from JMXAddressable
    Google Code Search
    Stack Overflow
  • getConnectionIdtop

    public synchronized String getConnectionId() throws IOException

    Gets 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.

    Return:
    @return the unique ID of this connection. This is the same as the ID that the connector server includes in its javax.management.remote.JMXConnectionNotification s. The package description describes the conventions for connection IDs.
    Exceptions:
    @exception IOException if the connection ID cannot be obtained, for instance because the connection is closed or broken.
    Specified by:
    getConnectionId from JMXConnector
    Google Code Search
    Stack Overflow
  • getMBeanServerConnectiontop

    public synchronized MBeanServerConnection getMBeanServerConnection() throws IOException

    Returns an MBeanServerConnection object representing a remote MBean server. For a given JMXConnector, two successful calls to this method will usually return the same MBeanServerConnection object, 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 an Exception, the same Exception is seen by the client. If the MBean server method, or the attempt to call it, produces an Error, the Error is 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 MBeanServerConnection must use the authenticated subject, if any.

    Return:
    @return an object that implements the MBeanServerConnection interface by forwarding its methods to the remote MBean server.
    Exceptions:
    @exception IOException if a valid MBeanServerConnection cannot be created, for instance because the connection to the remote MBean server has not yet been established (with the connect method), or it has been closed, or it has broken.
    Google Code Search
    Stack Overflow
  • getMBeanServerConnectiontop

    public synchronized MBeanServerConnection getMBeanServerConnection(Subject delegationSubject) throws IOException

    Returns an MBeanServerConnection object representing a remote MBean server on which operations are performed on behalf of the supplied delegation subject. For a given JMXConnector and Subject, two successful calls to this method will usually return the same MBeanServerConnection object, 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 an Exception, the same Exception is seen by the client. If the MBean server method, or the attempt to call it, produces an Error, the Error is wrapped in a javax.management.remote.JMXServerErrorException, which is seen by the client.

    Parameters:
    @param delegationSubject the Subject on behalf of which requests will be performed. Can be null, in which case requests will be performed on behalf of the authenticated Subject, if any.
    Return:
    @return an object that implements the MBeanServerConnection interface by forwarding its methods to the remote MBean server on behalf of a given delegation subject.
    Exceptions:
    @exception IOException if a valid MBeanServerConnection cannot be created, for instance because the connection to the remote MBean server has not yet been established (with the connect method), or it has been closed, or it has broken.
    Google Code Search
    Stack Overflow
  • removeConnectionNotificationListenertop

    public void removeConnectionNotificationListener(NotificationListener listener) throws ListenerNotFoundException

    Removes 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.

    Parameters:
    @param listener a listener to receive connection status notifications.
    Exceptions:
    @exception ListenerNotFoundException if the listener is not registered with this JMXConnector.
    Google Code Search
    Stack Overflow
  • removeConnectionNotificationListenertop

    public void removeConnectionNotificationListener(NotificationListener listener, NotificationFilter filter, Object handback) throws ListenerNotFoundException

    Removes 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.

    Parameters:
    @param handback an object to be given to the listener along with each notification. Can be null.
    Exceptions:
    @exception ListenerNotFoundException if the listener is not registered with this JMXConnector, or is not registered with the given filter and handback.
    Google Code Search
    Stack Overflow
  • toStringtop

    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.

    Return:
    @return a String representation of this object.
    Override hierarchy:
    toString from Object
    Google Code Search
    Stack Overflow