RemoteStub
Class <!----> Thejava.rmi.server.RemoteStub
class is the common superclass for stubs of remote objects. Stub objects are surrogates that support exactly the same set of remote interfaces defined by the actual implementation of a remote object.
package java.rmi.server;
public abstract class RemoteStub extends java.rmi.RemoteObject {
protected RemoteStub();
protected RemoteStub(RemoteRef ref);
protected static void setRef(RemoteStub stub, RemoteRef ref);
}
<!----> The first constructor ofRemoteStub
creates a stub with anull
remote reference. The second constructor creates a stub with the given remote reference, ref.<!----> The
setRef
method is deprecated (and unsupported) as of the Java 2 SDK, Standard Edition, v1.2.
<!----> Clients interact with stub (surrogate) objects that have exactly the same set of remote interfaces defined by the remote object's class; the stub class does not include the non-remote portions of the class hierarchy that constitutes the object's type graph. This is because the stub class is generated from the most refined implementation class that implements one or more remote interfaces. For example, if C extends B and B extends A, but only B implements a remote interface, then a stub is generated from B, not C.<!----> Because the stub implements the same set of remote interfaces as the remote object's class, the stub has the same type as the remote portions of the server object's type graph. A client, therefore, can make use of the built-in Java programming language operations to check a remote object's type and to cast from one remote interface to another.
<!----> Stubs are generated using the rmic compiler.
final
<!----> The following methods are declaredfinal
in thejava.lang.Object
class and therefore cannot be overridden by any implementation:
<!----> The default implementation for
getClass
is appropriate for all objects written in the Java programming language, local or remote; so, the method needs no special implementation for remote objects. When used on a remote stub, the
getClass
method reports the exact type of the stub object, generated by
rmic. Note that stub type reflects only the remote interfaces implemented by the remote object, not that object's local interfaces.
<!----> The wait
and notify
methods of java.lang.Object
deal with waiting and notification in the context of the Java programming language's threading model. While use of these methods for remote stubs does not break the threading model, these methods do not have the same semantics as they do for local objects written in the Java programming language. Specifically, using these methods operates on the client's local reference to the remote object (the stub), not the actual object at the remote site.
Skeleton
Interface <!----> The interfaceSkeleton
is used solely by the implementation of skeletons generated by thermic
compiler. A skeleton for a remote object is a server-side entity that dispatches calls to the actual remote object implementation.
Note - TheSkeleton
interface was deprecated as of the Java 2 SDK, Standard Edition, v1.2. Every 1.1 (and version 1.1 compatible skeletons generated in 1.2 usingrmic -vcompat
, the default) skeleton class generated by thermic
stub compiler implements this interface. Skeletons are no longer required for remote method call dispatch as of Java 2 SDK, Standard Edition, v1.2-compatible versions. To generate stubs that are compatible with 1.2 or later versions, use the commandrmic
with the option -v1.2.
<!----> Thepackage java.rmi.server;
public interface Skeleton {
void dispatch(Remote obj, RemoteCall call, int opnum, long hash)
throws Exception;
Operation[] getOperations();
}
dispatch
method unmarshals any arguments from the input stream obtained from the
call object, invokes the method (indicated by the operation number
opnum) on the actual remote object implementation
obj, and marshals the return value or throws an exception if one occurs during the invocation.
<!----> The getOperations
method returns an array containing the operation descriptors for the remote object's methods.