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.rmi
class PortableRemoteObject

java.lang.Object extended by javax.rmi.PortableRemoteObject

public class PortableRemoteObject
extends Object

Server implementation objects may either inherit from javax.rmi.PortableRemoteObject or they may implement a remote interface and then use the exportObject method to register themselves as a server object. The toStub method takes a server implementation and returns a stub that can be used to access that server object. The connect method makes a Remote object ready for remote communication. The unexportObject method is used to deregister a server object, allowing it to become available for garbage collection. The narrow method takes an object reference or abstract interface type and attempts to narrow it to conform to the given interface. If the operation is successful the result will be an object of the specified type, otherwise an exception will be thrown.


Constructor Summary
protected

          Initializes the object by calling exportObject(this).
 
Method Summary
static void
connect(Remote target, Remote source)

          Makes a Remote object ready for remote communication.
static void

          Makes a server object ready to receive remote calls.
static Object
narrow(Object narrowFrom, Class narrowTo)

          Checks to ensure that an object of a remote or abstract interface type can be cast to a desired type.
static Remote

          Returns a stub for the given server object.
static void

          Deregisters a server object from the runtime, allowing the object to become available for garbage collection.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PortableRemoteObject

protected PortableRemoteObject()
                        throws RemoteException
Initializes the object by calling exportObject(this).

Throws:
RemoteException - if export fails.
Method Detail

connect

public static void connect(Remote target,
                           Remote source)
                    throws RemoteException
Makes a Remote object ready for remote communication. This normally happens implicitly when the object is sent or received as an argument on a remote method call, but in some circumstances it is useful to perform this action by making an explicit call. See the {@link Stub#connect} method for more information.

Parameters:
target - the object to connect.
source - a previously connected object.
Throws:
RemoteException - if source is not connected or if target is already connected to a different ORB than source.

exportObject

public static void exportObject(Remote obj)
                         throws RemoteException
Makes a server object ready to receive remote calls. Note that subclasses of PortableRemoteObject do not need to call this method, as it is called by the constructor.

Parameters:
obj - the server object to export.
Throws:
RemoteException - if export fails.

narrow

public static Object narrow(Object narrowFrom,
                            Class narrowTo)
                     throws ClassCastException
Checks to ensure that an object of a remote or abstract interface type can be cast to a desired type.

Parameters:
narrowFrom - the object to check.
narrowTo - the desired type.
Returns:
an object which can be cast to the desired type.
Throws:
ClassCastException - if narrowFrom cannot be cast to narrowTo.

toStub

public static Remote toStub(Remote obj)
                     throws NoSuchObjectException
Returns a stub for the given server object.

Parameters:
obj - the server object for which a stub is required. Must either be a subclass of PortableRemoteObject or have been previously the target of a call to {@link #exportObject}.
Returns:
the most derived stub for the object.
Throws:
NoSuchObjectException - if a stub cannot be located for the given server object.

unexportObject

public static void unexportObject(Remote obj)
                           throws NoSuchObjectException
Deregisters a server object from the runtime, allowing the object to become available for garbage collection.

Parameters:
obj - the object to unexport.
Throws:
NoSuchObjectException - if the remote object is not currently exported.


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