Package com.sun.corba.ee.impl.javax.rmi
Class PortableRemoteObject
java.lang.Object
com.sun.corba.ee.impl.javax.rmi.PortableRemoteObject
- All Implemented Interfaces:
PortableRemoteObjectDelegate
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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
Makes a Remote object ready for remote communication.void
exportObject
(Remote obj) Makes a server object ready to receive remote calls.Checks to ensure that an object of a remote or abstract interface type can be cast to a desired type.Returns a stub for the given server object.void
unexportObject
(Remote obj) Deregisters a server object from the runtime, allowing the object to become available for garbage collection.
-
Constructor Details
-
PortableRemoteObject
public PortableRemoteObject()
-
-
Method Details
-
exportObject
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.- Specified by:
exportObject
in interfacePortableRemoteObjectDelegate
- Parameters:
obj
- the server object to export.- Throws:
RemoteException
- if export fails.
-
toStub
Returns a stub for the given server object.- Specified by:
toStub
in interfacePortableRemoteObjectDelegate
- 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 toexportObject(java.rmi.Remote)
.- Returns:
- the most derived stub for the object.
- Throws:
NoSuchObjectException
- if a stub cannot be located for the given server object.
-
unexportObject
Deregisters a server object from the runtime, allowing the object to become available for garbage collection.- Specified by:
unexportObject
in interfacePortableRemoteObjectDelegate
- Parameters:
obj
- the object to unexport.- Throws:
NoSuchObjectException
- if the remote object is not currently exported.
-
narrow
Checks to ensure that an object of a remote or abstract interface type can be cast to a desired type.- Specified by:
narrow
in interfacePortableRemoteObjectDelegate
- 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.
-
connect
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 theStub.connect(org.omg.CORBA.ORB)
method for more information.- Specified by:
connect
in interfacePortableRemoteObjectDelegate
- Parameters:
target
- the object to connect.source
- a previously connected object.- Throws:
RemoteException
- ifsource
is not connected or iftarget
is already connected to a different ORB thansource
.
-