CONTENTS | PREV | NEXT | Java Remote Method Invocation |
In the JDK1.1 stub protocol the
Operation represents the method number as assigned by
rmic, and the Hash was the stub/skeleton hash
which is the stub's interface hash. As of the Java 2 stub
protocol (Java 2 stubs are generated using the -v1.2
option with rmic
), Operation has the value -1
and the Hash is a hash representing the method to call.
The hash is described in the section "The RemoteRef
Interface".
A ReturnValue of an RMI
call consists of a return code to indicate either a normal or
exceptional return, a UniqueIdentifier to tag the return
value (used to send a DGCAck
if necessary) followed by
the return result: either the Value returned or the
Exception thrown.
annotateClass
and resolveClass
methods of
ObjectOutputStream
and ObjectInputStream
respectively. Each class is annotated with the codebase URL (the
location from which the class can be loaded). In the
annotateClass
method, the classloader that loaded the
class is queried for its codebase URL. If the classloader is
non-null
and the classloader has a
non-null
codebase, then the codebase is written to the
stream using the ObjectOutputStream.writeObject
method; otherwise a null
is written to the stream
using the writeObject
method. Note: as an
optimization, classes in the "java
" package
are not annotated, since they are always available to the receiver.
The class annotation is resolved
during deserialization using the
ObjectInputStream.resolveClass
method. The
resolveClass
method first reads the annotation via the
ObjectInputStream.readObject
method. If the
annotation, a codebase URL, is non-null
, then it
obtains the classloader for that URL and attempts to load the
class. The class is loaded by using a
java.net.URLConnection
to fetch the class bytes (the
same mechanism used by a web browser's applet classloader).