This documentation differs from the official API. Jadeite adds extra features to the API including: variable font sizes, constructions examples, placeholders for classes and methods, and auto-generated “See Also” links. Additionally it is missing some items found in standard Javadoc documentation, including: generics type information, “Deprecated” tags and comments, “See Also” links, along with other minor differences. Please send any questions or feedback to bam@cs.cmu.edu.


javax.management.remote.rmi
class RMIServerImpl

java.lang.Object extended by javax.management.remote.rmi.RMIServerImpl
All Implemented Interfaces:
Closeable, RMIServer
Direct Known Subclasses:
RMIIIOPServerImpl, RMIJRMPServerImpl

public abstract class RMIServerImpl
extends Object
implements Closeable, RMIServer

An RMI object representing a connector server. Remote clients can make connections using the {@link #newClient(Object)} method. This method returns an RMI object representing the connection.

User code does not usually reference this class directly. RMI connection servers are usually created with the class {@link RMIConnectorServer}. Remote clients usually create connections either with {@link javax.management.remote.JMXConnectorFactory} or by instantiating {@link RMIConnector}.

This is an abstract class. Concrete subclasses define the details of the client connection objects, such as whether they use JRMP or IIOP.


Constructor Summary

          Constructs a new RMIServerImpl.
 
Method Summary
protected void

          Method called when a client connection created by javax.management.remote.rmi.RMIServerImpl.makeClient is closed.
 void

          Closes this connection server.
protected abstract void

          Closes a client connection made by javax.management.remote.rmi.RMIServerImpl.makeClient.
protected abstract void

          Called by javax.management.remote.rmi.RMIServerImpl.close to close the connector server.
protected abstract void

          Exports this RMI object.
 ClassLoader

          Gets the default ClassLoader used by this connector server.
 MBeanServer

          The MBeanServer to which this connector server is attached.
protected abstract String

          Returns the protocol string for this object.
 String

          
protected abstract RMIConnection
makeClient(String connectionId, Subject subject)

          Creates a new client connection.
 RMIConnection
newClient(Object credentials)

          Creates a new client connection.
 void

          Sets the default ClassLoader for this connector server.
 void

          Sets the MBeanServer to which this connector server is attached.
abstract Remote

          Returns a remotable stub for this server object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RMIServerImpl

public RMIServerImpl(Map env)

Constructs a new RMIServerImpl.

Parameters:
env - the environment containing attributes for the new RMIServerImpl. Can be null, which is equivalent to an empty Map.
Method Detail

clientClosed

protected void clientClosed(RMIConnection client)
                     throws IOException

Method called when a client connection created by {@link #makeClient makeClient} is closed. A subclass that defines makeClient must arrange for this method to be called when the resultant object's {@link RMIConnection#close() close} method is called. This enables it to be removed from the RMIServerImpl's list of connections. It is not an error for client not to be in that list.

After removing client from the list of connections, this method calls {@link #closeClient closeClient(client)}.

Parameters:
client - the client connection that has been closed.
Throws:
IOException - if {@link #closeClient} throws this exception.

close

public synchronized void close()
                        throws IOException

Closes this connection server. This method first calls the {@link #closeServer()} method so that no new client connections will be accepted. Then, for each remaining {@link RMIConnection} object returned by {@link #makeClient makeClient}, its {@link RMIConnection#close() close} method is called.

The behavior when this method is called more than once is unspecified.

If {@link #closeServer()} throws an IOException, the individual connections are nevertheless closed, and then the IOException is thrown from this method.

If {@link #closeServer()} returns normally but one or more of the individual connections throws an IOException, then, after closing all the connections, one of those IOExceptions is thrown from this method. If more than one connection throws an IOException, it is unspecified which one is thrown from this method.

Throws:
IOException - if {@link #closeServer()} or one of the {@link RMIConnection#close()} calls threw IOException.

closeClient

protected abstract void closeClient(RMIConnection client)
                             throws IOException

Closes a client connection made by {@link #makeClient makeClient}.

Parameters:
client - a connection previously returned by makeClient on which the closeClient method has not previously been called. The behavior is unspecified if these conditions are violated, including the case where client is null.
Throws:
IOException - if the client connection cannot be closed.

closeServer

protected abstract void closeServer()
                             throws IOException

Called by {@link #close()} to close the connector server. After returning from this method, the connector server must not accept any new connections.

Throws:
IOException - if the attempt to close the connector server failed.

export

protected abstract void export()
                        throws IOException

Exports this RMI object.

Throws:
IOException - if this RMI object cannot be exported.

getDefaultClassLoader

public synchronized ClassLoader getDefaultClassLoader()

Gets the default ClassLoader used by this connector server.

Returns:
the default ClassLoader used by this connector server.


getMBeanServer

public synchronized MBeanServer getMBeanServer()

The MBeanServer to which this connector server is attached. This is the last value passed to {@link #setMBeanServer} on this object, or null if that method has never been called.

Returns:
the MBeanServer to which this connector is attached.

getProtocol

protected abstract String getProtocol()

Returns the protocol string for this object. The string is rmi for RMI/JRMP and iiop for RMI/IIOP.

Returns:
the protocol string for this object.

getVersion

public String getVersion()

makeClient

protected abstract RMIConnection makeClient(String connectionId,
                                            Subject subject)
                                     throws IOException

Creates a new client connection. This method is called by the public method {@link #newClient(Object)}.

Parameters:
connectionId - the ID of the new connection. Every connection opened by this connector server will have a different ID. The behavior is unspecified if this parameter is null.
subject - the authenticated subject. Can be null.
Returns:
the newly-created RMIConnection.
Throws:
IOException - if the new client object cannot be created or exported.

newClient

public RMIConnection newClient(Object credentials)
                        throws IOException

Creates a new client connection. This method calls {@link #makeClient makeClient} and adds the returned client connection object to an internal list. When this RMIServerImpl is shut down via its {@link #close()} method, the {@link RMIConnection#close() close()} method of each object remaining in the list is called.

The fact that a client connection object is in this internal list does not prevent it from being garbage collected.

Parameters:
credentials - this object specifies the user-defined credentials to be passed in to the server in order to authenticate the caller before creating the RMIConnection. Can be null.
Returns:
the newly-created RMIConnection. This is usually the object created by makeClient, though an implementation may choose to wrap that object in another object implementing RMIConnection.
Throws:
IOException - if the new client object cannot be created or exported.

setDefaultClassLoader

public synchronized void setDefaultClassLoader(ClassLoader cl)

Sets the default ClassLoader for this connector server. New client connections will use this classloader. Existing client connections are unaffected.

Parameters:
cl - the new ClassLoader to be used by this connector server.

setMBeanServer

public synchronized void setMBeanServer(MBeanServer mbs)

Sets the MBeanServer to which this connector server is attached. New client connections will interact with this MBeanServer. Existing client connections are unaffected.

Parameters:
mbs - the new MBeanServer. Can be null, but new client connections will be refused as long as it is.

toStub

public abstract Remote toStub()
                       throws IOException
Returns a remotable stub for this server object.

Returns:
a remotable stub.
Throws:
IOException - if the stub cannot be obtained - e.g the RMIServerImpl has not been exported yet.


This documentation differs from the official API. Jadeite adds extra features to the API including: variable font sizes, constructions examples, placeholders for classes and methods, and auto-generated “See Also” links. Additionally it is missing some items found in standard Javadoc documentation, including: generics type information, “Deprecated” tags and comments, “See Also” links, along with other minor differences. Please send any questions or feedback to bam@cs.cmu.edu.
This page displays the Jadeite version of the documention, which is derived from the offical documentation that contains this copyright notice:
Copyright 2008 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.
The official Sun™ documentation can be found here at http://java.sun.com/javase/6/docs/api/.