javax.management.remote.rmi
Class RMIServerImpl

java.lang.Object sample code for java.lang.Object definition code for java.lang.Object 
  extended by javax.management.remote.rmi.RMIServerImpl
All Implemented Interfaces:
Remote sample code for java.rmi.Remote definition code for java.rmi.Remote , RMIServer sample code for javax.management.remote.rmi.RMIServer definition code for javax.management.remote.rmi.RMIServer
Direct Known Subclasses:
RMIIIOPServerImpl sample code for javax.management.remote.rmi.RMIIIOPServerImpl definition code for javax.management.remote.rmi.RMIIIOPServerImpl , RMIJRMPServerImpl sample code for javax.management.remote.rmi.RMIJRMPServerImpl definition code for javax.management.remote.rmi.RMIJRMPServerImpl

public abstract class RMIServerImpl
extends Object sample code for java.lang.Object definition code for java.lang.Object
implements RMIServer sample code for javax.management.remote.rmi.RMIServer definition code for javax.management.remote.rmi.RMIServer

An RMI object representing a connector server. Remote clients can make connections using the newClient(Object) sample code for javax.management.remote.rmi.RMIServerImpl.newClient(java.lang.Object) definition code for javax.management.remote.rmi.RMIServerImpl.newClient(java.lang.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 RMIConnectorServer sample code for javax.management.remote.rmi.RMIConnectorServer definition code for javax.management.remote.rmi.RMIConnectorServer . Remote clients usually create connections either with JMXConnectorFactory sample code for javax.management.remote.JMXConnectorFactory definition code for javax.management.remote.JMXConnectorFactory or by instantiating RMIConnector sample code for javax.management.remote.rmi.RMIConnector definition code for javax.management.remote.rmi.RMIConnector .

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

Since:
1.5

Constructor Summary
RMIServerImpl sample code for javax.management.remote.rmi.RMIServerImpl.RMIServerImpl(java.util.Map) definition code for javax.management.remote.rmi.RMIServerImpl.RMIServerImpl(java.util.Map) (Map sample code for java.util.Map definition code for java.util.Map <String sample code for java.lang.String definition code for java.lang.String ,?> env)
          Constructs a new RMIServerImpl.
 
Method Summary
protected  void clientClosed sample code for javax.management.remote.rmi.RMIServerImpl.clientClosed(javax.management.remote.rmi.RMIConnection) definition code for javax.management.remote.rmi.RMIServerImpl.clientClosed(javax.management.remote.rmi.RMIConnection) (RMIConnection sample code for javax.management.remote.rmi.RMIConnection definition code for javax.management.remote.rmi.RMIConnection  client)
          Method called when a client connection created by makeClient sample code for javax.management.remote.rmi.RMIServerImpl.makeClient(java.lang.String, javax.security.auth.Subject) definition code for javax.management.remote.rmi.RMIServerImpl.makeClient(java.lang.String, javax.security.auth.Subject) is closed.
 void close sample code for javax.management.remote.rmi.RMIServerImpl.close() definition code for javax.management.remote.rmi.RMIServerImpl.close() ()
          Closes this connection server.
protected abstract  void closeClient sample code for javax.management.remote.rmi.RMIServerImpl.closeClient(javax.management.remote.rmi.RMIConnection) definition code for javax.management.remote.rmi.RMIServerImpl.closeClient(javax.management.remote.rmi.RMIConnection) (RMIConnection sample code for javax.management.remote.rmi.RMIConnection definition code for javax.management.remote.rmi.RMIConnection  client)
          Closes a client connection made by makeClient sample code for javax.management.remote.rmi.RMIServerImpl.makeClient(java.lang.String, javax.security.auth.Subject) definition code for javax.management.remote.rmi.RMIServerImpl.makeClient(java.lang.String, javax.security.auth.Subject) .
protected abstract  void closeServer sample code for javax.management.remote.rmi.RMIServerImpl.closeServer() definition code for javax.management.remote.rmi.RMIServerImpl.closeServer() ()
          Called by close() sample code for javax.management.remote.rmi.RMIServerImpl.close() definition code for javax.management.remote.rmi.RMIServerImpl.close() to close the connector server.
protected abstract  void export sample code for javax.management.remote.rmi.RMIServerImpl.export() definition code for javax.management.remote.rmi.RMIServerImpl.export() ()
          Exports this RMI object.
 ClassLoader sample code for java.lang.ClassLoader definition code for java.lang.ClassLoader getDefaultClassLoader sample code for javax.management.remote.rmi.RMIServerImpl.getDefaultClassLoader() definition code for javax.management.remote.rmi.RMIServerImpl.getDefaultClassLoader() ()
          Gets the default ClassLoader used by this connector server.
 MBeanServer sample code for javax.management.MBeanServer definition code for javax.management.MBeanServer getMBeanServer sample code for javax.management.remote.rmi.RMIServerImpl.getMBeanServer() definition code for javax.management.remote.rmi.RMIServerImpl.getMBeanServer() ()
          The MBeanServer to which this connector server is attached.
protected abstract  String sample code for java.lang.String definition code for java.lang.String getProtocol sample code for javax.management.remote.rmi.RMIServerImpl.getProtocol() definition code for javax.management.remote.rmi.RMIServerImpl.getProtocol() ()
          Returns the protocol string for this object.
 String sample code for java.lang.String definition code for java.lang.String getVersion sample code for javax.management.remote.rmi.RMIServerImpl.getVersion() definition code for javax.management.remote.rmi.RMIServerImpl.getVersion() ()
          The version of the RMI Connector Protocol understood by this connector server.
protected abstract  RMIConnection sample code for javax.management.remote.rmi.RMIConnection definition code for javax.management.remote.rmi.RMIConnection makeClient sample code for javax.management.remote.rmi.RMIServerImpl.makeClient(java.lang.String, javax.security.auth.Subject) definition code for javax.management.remote.rmi.RMIServerImpl.makeClient(java.lang.String, javax.security.auth.Subject) (String sample code for java.lang.String definition code for java.lang.String  connectionId, Subject sample code for javax.security.auth.Subject definition code for javax.security.auth.Subject  subject)
          Creates a new client connection.
 RMIConnection sample code for javax.management.remote.rmi.RMIConnection definition code for javax.management.remote.rmi.RMIConnection newClient sample code for javax.management.remote.rmi.RMIServerImpl.newClient(java.lang.Object) definition code for javax.management.remote.rmi.RMIServerImpl.newClient(java.lang.Object) (Object sample code for java.lang.Object definition code for java.lang.Object  credentials)
          Creates a new client connection.
 void setDefaultClassLoader sample code for javax.management.remote.rmi.RMIServerImpl.setDefaultClassLoader(java.lang.ClassLoader) definition code for javax.management.remote.rmi.RMIServerImpl.setDefaultClassLoader(java.lang.ClassLoader) (ClassLoader sample code for java.lang.ClassLoader definition code for java.lang.ClassLoader  cl)
          Sets the default ClassLoader for this connector server.
 void setMBeanServer sample code for javax.management.remote.rmi.RMIServerImpl.setMBeanServer(javax.management.MBeanServer) definition code for javax.management.remote.rmi.RMIServerImpl.setMBeanServer(javax.management.MBeanServer) (MBeanServer sample code for javax.management.MBeanServer definition code for javax.management.MBeanServer  mbs)
          Sets the MBeanServer to which this connector server is attached.
abstract  Remote sample code for java.rmi.Remote definition code for java.rmi.Remote toStub sample code for javax.management.remote.rmi.RMIServerImpl.toStub() definition code for javax.management.remote.rmi.RMIServerImpl.toStub() ()
          Returns a remotable stub for this server object.
 
Methods inherited from class java.lang.Object sample code for java.lang.Object definition code for java.lang.Object
clone sample code for java.lang.Object.clone() definition code for java.lang.Object.clone() , equals sample code for java.lang.Object.equals(java.lang.Object) definition code for java.lang.Object.equals(java.lang.Object) , finalize sample code for java.lang.Object.finalize() definition code for java.lang.Object.finalize() , getClass sample code for java.lang.Object.getClass() definition code for java.lang.Object.getClass() , hashCode sample code for java.lang.Object.hashCode() definition code for java.lang.Object.hashCode() , notify sample code for java.lang.Object.notify() definition code for java.lang.Object.notify() , notifyAll sample code for java.lang.Object.notifyAll() definition code for java.lang.Object.notifyAll() , toString sample code for java.lang.Object.toString() definition code for java.lang.Object.toString() , wait sample code for java.lang.Object.wait() definition code for java.lang.Object.wait() , wait sample code for java.lang.Object.wait(long) definition code for java.lang.Object.wait(long) , wait sample code for java.lang.Object.wait(long, int) definition code for java.lang.Object.wait(long, int)
 

Constructor Detail

RMIServerImpl sample code for javax.management.remote.rmi.RMIServerImpl(java.util.Map<java.lang.String, ?>) definition code for javax.management.remote.rmi.RMIServerImpl(java.util.Map<java.lang.String, ?>)

public RMIServerImpl(Map sample code for java.util.Map definition code for java.util.Map <String sample code for java.lang.String definition code for java.lang.String ,?> 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

export sample code for javax.management.remote.rmi.RMIServerImpl.export() definition code for javax.management.remote.rmi.RMIServerImpl.export()

protected abstract void export()
                        throws IOException sample code for java.io.IOException definition code for java.io.IOException 

Exports this RMI object.

Throws:
IOException sample code for java.io.IOException definition code for java.io.IOException - if this RMI object cannot be exported.

toStub sample code for javax.management.remote.rmi.RMIServerImpl.toStub() definition code for javax.management.remote.rmi.RMIServerImpl.toStub()

public abstract Remote sample code for java.rmi.Remote definition code for java.rmi.Remote  toStub()
                       throws IOException sample code for java.io.IOException definition code for java.io.IOException 
Returns a remotable stub for this server object.

Returns:
a remotable stub.
Throws:
IOException sample code for java.io.IOException definition code for java.io.IOException - if the stub cannot be obtained - e.g the RMIServerImpl has not been exported yet.

setDefaultClassLoader sample code for javax.management.remote.rmi.RMIServerImpl.setDefaultClassLoader(java.lang.ClassLoader) definition code for javax.management.remote.rmi.RMIServerImpl.setDefaultClassLoader(java.lang.ClassLoader)

public void setDefaultClassLoader(ClassLoader sample code for java.lang.ClassLoader definition code for java.lang.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.
See Also:
getDefaultClassLoader() sample code for javax.management.remote.rmi.RMIServerImpl.getDefaultClassLoader() definition code for javax.management.remote.rmi.RMIServerImpl.getDefaultClassLoader()

getDefaultClassLoader sample code for javax.management.remote.rmi.RMIServerImpl.getDefaultClassLoader() definition code for javax.management.remote.rmi.RMIServerImpl.getDefaultClassLoader()

public ClassLoader sample code for java.lang.ClassLoader definition code for java.lang.ClassLoader  getDefaultClassLoader()

Gets the default ClassLoader used by this connector server.

Returns:
the default ClassLoader used by this connector server.

See Also:
setDefaultClassLoader(java.lang.ClassLoader) sample code for javax.management.remote.rmi.RMIServerImpl.setDefaultClassLoader(java.lang.ClassLoader) definition code for javax.management.remote.rmi.RMIServerImpl.setDefaultClassLoader(java.lang.ClassLoader)

setMBeanServer sample code for javax.management.remote.rmi.RMIServerImpl.setMBeanServer(javax.management.MBeanServer) definition code for javax.management.remote.rmi.RMIServerImpl.setMBeanServer(javax.management.MBeanServer)

public void setMBeanServer(MBeanServer sample code for javax.management.MBeanServer definition code for javax.management.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.
See Also:
getMBeanServer() sample code for javax.management.remote.rmi.RMIServerImpl.getMBeanServer() definition code for javax.management.remote.rmi.RMIServerImpl.getMBeanServer()

getMBeanServer sample code for javax.management.remote.rmi.RMIServerImpl.getMBeanServer() definition code for javax.management.remote.rmi.RMIServerImpl.getMBeanServer()

public MBeanServer sample code for javax.management.MBeanServer definition code for javax.management.MBeanServer  getMBeanServer()

The MBeanServer to which this connector server is attached. This is the last value passed to setMBeanServer(javax.management.MBeanServer) sample code for javax.management.remote.rmi.RMIServerImpl.setMBeanServer(javax.management.MBeanServer) definition code for javax.management.remote.rmi.RMIServerImpl.setMBeanServer(javax.management.MBeanServer) on this object, or null if that method has never been called.

Returns:
the MBeanServer to which this connector is attached.
See Also:
setMBeanServer(javax.management.MBeanServer) sample code for javax.management.remote.rmi.RMIServerImpl.setMBeanServer(javax.management.MBeanServer) definition code for javax.management.remote.rmi.RMIServerImpl.setMBeanServer(javax.management.MBeanServer)

getVersion sample code for javax.management.remote.rmi.RMIServerImpl.getVersion() definition code for javax.management.remote.rmi.RMIServerImpl.getVersion()

public String sample code for java.lang.String definition code for java.lang.String  getVersion()
Description copied from interface: RMIServer sample code for javax.management.remote.rmi.RMIServer.getVersion() definition code for javax.management.remote.rmi.RMIServer.getVersion()

The version of the RMI Connector Protocol understood by this connector server. This is a string with the following format:

 protocol-version implementation-name
 

The protocol-version is a series of two or more non-negative integers separated by periods (.). An implementation of the version described by this documentation must use the string 1.0 here.

After the protocol version there must be a space, followed by the implementation name. The format of the implementation name is unspecified. It is recommended that it include an implementation version number. An implementation can use an empty string as its implementation name, for example for security reasons.

Specified by:
getVersion sample code for javax.management.remote.rmi.RMIServer.getVersion() definition code for javax.management.remote.rmi.RMIServer.getVersion() in interface RMIServer sample code for javax.management.remote.rmi.RMIServer definition code for javax.management.remote.rmi.RMIServer
Returns:
a string with the format described here.

newClient sample code for javax.management.remote.rmi.RMIServerImpl.newClient(java.lang.Object) definition code for javax.management.remote.rmi.RMIServerImpl.newClient(java.lang.Object)

public RMIConnection sample code for javax.management.remote.rmi.RMIConnection definition code for javax.management.remote.rmi.RMIConnection  newClient(Object sample code for java.lang.Object definition code for java.lang.Object  credentials)
                        throws IOException sample code for java.io.IOException definition code for java.io.IOException 

Creates a new client connection. This method calls makeClient sample code for javax.management.remote.rmi.RMIServerImpl.makeClient(java.lang.String, javax.security.auth.Subject) definition code for javax.management.remote.rmi.RMIServerImpl.makeClient(java.lang.String, javax.security.auth.Subject) and adds the returned client connection object to an internal list. When this RMIServerImpl is shut down via its close() sample code for javax.management.remote.rmi.RMIServerImpl.close() definition code for javax.management.remote.rmi.RMIServerImpl.close() method, the close() sample code for javax.management.remote.rmi.RMIConnection.close() definition code for javax.management.remote.rmi.RMIConnection.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.

Specified by:
newClient sample code for javax.management.remote.rmi.RMIServer.newClient(java.lang.Object) definition code for javax.management.remote.rmi.RMIServer.newClient(java.lang.Object) in interface RMIServer sample code for javax.management.remote.rmi.RMIServer definition code for javax.management.remote.rmi.RMIServer
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 sample code for java.io.IOException definition code for java.io.IOException - if the new client object cannot be created or exported.
SecurityException sample code for java.lang.SecurityException definition code for java.lang.SecurityException - if the given credentials do not allow the server to authenticate the user successfully.
IllegalStateException sample code for java.lang.IllegalStateException definition code for java.lang.IllegalStateException - if getMBeanServer() sample code for javax.management.remote.rmi.RMIServerImpl.getMBeanServer() definition code for javax.management.remote.rmi.RMIServerImpl.getMBeanServer() is null.

makeClient sample code for javax.management.remote.rmi.RMIServerImpl.makeClient(java.lang.String, javax.security.auth.Subject) definition code for javax.management.remote.rmi.RMIServerImpl.makeClient(java.lang.String, javax.security.auth.Subject)

protected abstract RMIConnection sample code for javax.management.remote.rmi.RMIConnection definition code for javax.management.remote.rmi.RMIConnection  makeClient(String sample code for java.lang.String definition code for java.lang.String  connectionId,
                                            Subject sample code for javax.security.auth.Subject definition code for javax.security.auth.Subject  subject)
                                     throws IOException sample code for java.io.IOException definition code for java.io.IOException 

Creates a new client connection. This method is called by the public method newClient(Object) sample code for javax.management.remote.rmi.RMIServerImpl.newClient(java.lang.Object) definition code for javax.management.remote.rmi.RMIServerImpl.newClient(java.lang.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 sample code for java.io.IOException definition code for java.io.IOException - if the new client object cannot be created or exported.

closeClient sample code for javax.management.remote.rmi.RMIServerImpl.closeClient(javax.management.remote.rmi.RMIConnection) definition code for javax.management.remote.rmi.RMIServerImpl.closeClient(javax.management.remote.rmi.RMIConnection)

protected abstract void closeClient(RMIConnection sample code for javax.management.remote.rmi.RMIConnection definition code for javax.management.remote.rmi.RMIConnection  client)
                             throws IOException sample code for java.io.IOException definition code for java.io.IOException 

Closes a client connection made by makeClient sample code for javax.management.remote.rmi.RMIServerImpl.makeClient(java.lang.String, javax.security.auth.Subject) definition code for javax.management.remote.rmi.RMIServerImpl.makeClient(java.lang.String, javax.security.auth.Subject) .

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 sample code for java.io.IOException definition code for java.io.IOException - if the client connection cannot be closed.

getProtocol sample code for javax.management.remote.rmi.RMIServerImpl.getProtocol() definition code for javax.management.remote.rmi.RMIServerImpl.getProtocol()

protected abstract String sample code for java.lang.String definition code for java.lang.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.

clientClosed sample code for javax.management.remote.rmi.RMIServerImpl.clientClosed(javax.management.remote.rmi.RMIConnection) definition code for javax.management.remote.rmi.RMIServerImpl.clientClosed(javax.management.remote.rmi.RMIConnection)

protected void clientClosed(RMIConnection sample code for javax.management.remote.rmi.RMIConnection definition code for javax.management.remote.rmi.RMIConnection  client)
                     throws IOException sample code for java.io.IOException definition code for java.io.IOException 

Method called when a client connection created by makeClient sample code for javax.management.remote.rmi.RMIServerImpl.makeClient(java.lang.String, javax.security.auth.Subject) definition code for javax.management.remote.rmi.RMIServerImpl.makeClient(java.lang.String, javax.security.auth.Subject) is closed. A subclass that defines makeClient must arrange for this method to be called when the resultant object's close sample code for javax.management.remote.rmi.RMIConnection.close() definition code for javax.management.remote.rmi.RMIConnection.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 closeClient(client) sample code for javax.management.remote.rmi.RMIServerImpl.closeClient(javax.management.remote.rmi.RMIConnection) definition code for javax.management.remote.rmi.RMIServerImpl.closeClient(javax.management.remote.rmi.RMIConnection) .

Parameters:
client - the client connection that has been closed.
Throws:
IOException sample code for java.io.IOException definition code for java.io.IOException - if closeClient(javax.management.remote.rmi.RMIConnection) sample code for javax.management.remote.rmi.RMIServerImpl.closeClient(javax.management.remote.rmi.RMIConnection) definition code for javax.management.remote.rmi.RMIServerImpl.closeClient(javax.management.remote.rmi.RMIConnection) throws this exception.
NullPointerException sample code for java.lang.NullPointerException definition code for java.lang.NullPointerException - if client is null.

close sample code for javax.management.remote.rmi.RMIServerImpl.close() definition code for javax.management.remote.rmi.RMIServerImpl.close()

public void close()
           throws IOException sample code for java.io.IOException definition code for java.io.IOException 

Closes this connection server. This method first calls the closeServer() sample code for javax.management.remote.rmi.RMIServerImpl.closeServer() definition code for javax.management.remote.rmi.RMIServerImpl.closeServer() method so that no new client connections will be accepted. Then, for each remaining RMIConnection sample code for javax.management.remote.rmi.RMIConnection definition code for javax.management.remote.rmi.RMIConnection object returned by makeClient sample code for javax.management.remote.rmi.RMIServerImpl.makeClient(java.lang.String, javax.security.auth.Subject) definition code for javax.management.remote.rmi.RMIServerImpl.makeClient(java.lang.String, javax.security.auth.Subject) , its close sample code for javax.management.remote.rmi.RMIConnection.close() definition code for javax.management.remote.rmi.RMIConnection.close() method is called.

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

If closeServer() sample code for javax.management.remote.rmi.RMIServerImpl.closeServer() definition code for javax.management.remote.rmi.RMIServerImpl.closeServer() throws an IOException, the individual connections are nevertheless closed, and then the IOException is thrown from this method.

If closeServer() sample code for javax.management.remote.rmi.RMIServerImpl.closeServer() definition code for javax.management.remote.rmi.RMIServerImpl.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 sample code for java.io.IOException definition code for java.io.IOException - if closeServer() sample code for javax.management.remote.rmi.RMIServerImpl.closeServer() definition code for javax.management.remote.rmi.RMIServerImpl.closeServer() or one of the RMIConnection.close() sample code for javax.management.remote.rmi.RMIConnection.close() definition code for javax.management.remote.rmi.RMIConnection.close() calls threw IOException.

closeServer sample code for javax.management.remote.rmi.RMIServerImpl.closeServer() definition code for javax.management.remote.rmi.RMIServerImpl.closeServer()

protected abstract void closeServer()
                             throws IOException sample code for java.io.IOException definition code for java.io.IOException 

Called by close() sample code for javax.management.remote.rmi.RMIServerImpl.close() definition code for javax.management.remote.rmi.RMIServerImpl.close() to close the connector server. After returning from this method, the connector server must not accept any new connections.

Throws:
IOException sample code for java.io.IOException definition code for java.io.IOException - if the attempt to close the connector server failed.