public interface java.rmi.server
RemoteRef


Show All Login
Java SE 6
  
Implements: Externalizable
Implemented by: ServerRef
Details
RemoteRef represents the handle for a remote object. A RemoteStub uses a remote reference to carry out a remote method invocation to a remote object.
version1.24, 11/17/05
sinceJDK1.1
See also java.rmi.server.RemoteStub

Fields
final public static long serialVersionUID
indicate compatibility with JDK 1.1.x version of class.
final public static String packagePrefix
Initialize the server package prefix: assumes that the implementation of server ref classes (e.g., UnicastRef, UnicastServerRef) are located in the package defined by the prefix.

Methods
public void
done(RemoteCall call) throws RemoteException
Details
Allows the remote reference to clean up (or reuse) the connection. Done should only be called if the invoke returns successfully (non-exceptionally) to the stub.
sinceJDK1.1
deprecated1.2 style stubs no longer use this method. Instead of using a sequence of method calls to the remote reference (newCall, invoke, and done), a stub uses a single method, invoke(Remote, Method, Object[], int), on the remote reference to carry out parameter marshalling, remote method executing and unmarshalling of the return value.
callobject representing remote call
ThrowsRemoteException: if remote error occurs during call cleanup
See also invoke(Remote,java.lang.reflect.Method,Object[],long)
public Object invoke(Remote obj, Method method, Object[] params, long opnum) throws Exception Details
Invoke a method. This form of delegating method invocation to the reference allows the reference to take care of setting up the connection to the remote host, marshaling some representation for the method and parameters, then communicating the method invocation to the remote host. This method either returns the result of a method invocation on the remote object which resides on the remote host or throws a RemoteException if the call failed or an application-level exception if the remote invocation throws an exception.
objthe object that contains the RemoteRef (e.g., the RemoteStub for the object.
methodthe method to be invoked
paramsthe parameter list
opnuma hash that may be used to represent the method
returnresult of remote method invocation
ThrowsException: if any exception occurs during remote method invocation
since1.2
public void
invoke(RemoteCall call) throws Exception
Details
Executes the remote call. Invoke will raise any "user" exceptions which should pass through and not be caught by the stub. If any exception is raised during the remote invocation, invoke should take care of cleaning up the connection before raising the "user" or remote exception.
sinceJDK1.1
deprecated1.2 style stubs no longer use this method. Instead of using a sequence of method calls to the remote reference (newCall, invoke, and done), a stub uses a single method, invoke(Remote, Method, Object[], int), on the remote reference to carry out parameter marshalling, remote method executing and unmarshalling of the return value.
callobject representing remote call
ThrowsException: if any exception occurs during remote method
See also invoke(Remote,java.lang.reflect.Method,Object[],long)
public RemoteCall
newCall(RemoteObject obj, Operation[] op, int opnum, long hash) throws RemoteException
Details
Creates an appropriate call object for a new remote method invocation on this object. Passing operation array and index, allows the stubs generator to assign the operation indexes and interpret them. The remote reference may need the operation to encode in the call.
sinceJDK1.1
deprecated1.2 style stubs no longer use this method. Instead of using a sequence of method calls on the stub's the remote reference (newCall, invoke, and done), a stub uses a single method, invoke(Remote, Method, Object[], int), on the remote reference to carry out parameter marshalling, remote method executing and unmarshalling of the return value.
objremote stub through which to make call
oparray of stub operations
opnumoperation number
hashstub/skeleton interface hash
returncall object representing remote call
ThrowsRemoteException: if failed to initiate new remote call
See also invoke(Remote,java.lang.reflect.Method,Object[],long)
public boolean remoteEquals(RemoteRef obj) Details
Compares two remote objects for equality. Returns a boolean that indicates whether this remote object is equivalent to the specified Object. This method is used when a remote object is stored in a hashtable.
objthe Object to compare with
returntrue if these Objects are equal; false otherwise.
sinceJDK1.1
See also java.util.Hashtable
public int remoteHashCode() Details
Returns a hashcode for a remote object. Two remote object stubs that refer to the same remote object will have the same hash code (in order to support remote objects as keys in hash tables).
returnremote object hashcode
sinceJDK1.1
See also java.util.Hashtable
public String remoteToString() Details
Returns a String that represents the reference of this remote object.
returnstring representing remote object reference
sinceJDK1.1

Properties
public String getRefClass(ObjectOutput out) Details
Returns the class name of the ref type to be serialized onto the stream 'out'.
outthe output stream to which the reference will be serialized
returnthe class name (without package qualification) of the reference type
sinceJDK1.1