|
JavaTM 2 Platform Std. Ed. v1.3.1 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--javax.rmi.PortableRemoteObject
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 |
PortableRemoteObject()
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 |
exportObject(Remote obj)
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 |
toStub(Remote obj)
Returns a stub for the given server object. |
static void |
unexportObject(Remote obj)
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 |
protected PortableRemoteObject() throws RemoteException
exportObject(this)
.RemoteException
- if export fails.Method Detail |
public static void exportObject(Remote obj) throws RemoteException
obj
- the server object to export.RemoteException
- if export fails.public static Remote toStub(Remote obj) throws NoSuchObjectException
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
exportObject(java.rmi.Remote)
.NoSuchObjectException
- if a stub cannot be located for the given server object.public static void unexportObject(Remote obj) throws NoSuchObjectException
obj
- the object to unexport.NoSuchObjectException
- if the remote object is not
currently exported.public static Object narrow(Object narrowFrom, Class narrowTo) throws ClassCastException
narrowFrom
- the object to check.narrowTo
- the desired type.ClassCastException
- if narrowFrom cannot be cast to narrowTo.public static void connect(Remote target, Remote source) throws RemoteException
Stub#connect
method for more information.target
- the object to connect.source
- a previously connected object.RemoteException
- if source
is not connected
or if target
is already connected to a different ORB than
source
.
|
JavaTM 2 Platform Std. Ed. v1.3.1 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Java, Java 2D, and JDBC are trademarks or registered trademarks of Oracle and/or its affiliates, in the US and other countries.
Copyright © 1995, 2010 Oracle and/or its affiliates. All rights reserved.