public class

UnicastRef

extends Object
implements RemoteRef
java.lang.Object
   ↳ sun.rmi.server.UnicastRef
Known Direct Subclasses
Known Indirect Subclasses

Class Overview

NOTE: There is a JDK-internal dependency on the existence of this class's getLiveRef method (as it is inherited by UnicastRef2) in the implementation of javax.management.remote.rmi.RMIConnector.

Summary

[Expand]
Inherited Constants
From interface java.rmi.server.RemoteRef
Fields
public static final Log clientCallLog Client-side call log.
public static final Log clientRefLog Client-side transport log.
protected LiveRef ref
Public Constructors
UnicastRef()
Create a new (empty) Unicast remote reference.
UnicastRef(LiveRef liveRef)
Create a new Unicast RemoteRef.
Public Methods
void done(RemoteCall call)
Done should only be called if the invoke returns successfully (non-exceptionally) to the stub.
LiveRef getLiveRef()
Returns the current value of this UnicastRef's underlying LiveRef.
String getRefClass(ObjectOutput out)
Returns the class of the ref type to be serialized
void invoke(RemoteCall call)
Invoke makes the remote call present in the RemoteCall object.
Object invoke(Remote obj, Method method, Object[] params, long opnum)
Invoke a method.
RemoteCall newCall(RemoteObject obj, Operation[] ops, int opnum, long hash)
Create an appropriate call object for a new call on this object.
void readExternal(ObjectInput in)
Read in external representation for remote ref.
boolean remoteEquals(RemoteRef sub)
default implementation of equals for remote objects
int remoteHashCode()
default implementation of hashCode for remote objects
String remoteToString()
Method from object, forward from RemoteObject
void writeExternal(ObjectOutput out)
Write out external representation for remote ref.
Protected Methods
void marshalCustomCallData(ObjectOutput out)
static void marshalValue(Class<?> type, Object value, ObjectOutput out)
Marshal value to an ObjectOutput sink using RMI's serialization format for parameters or return values.
static Object unmarshalValue(Class<?> type, ObjectInput in)
Unmarshal value from an ObjectInput source using RMI's serialization format for parameters or return values.
[Expand]
Inherited Methods
From class java.lang.Object
From interface java.io.Externalizable
From interface java.rmi.server.RemoteRef

Fields

public static final Log clientCallLog

Client-side call log.

public static final Log clientRefLog

Client-side transport log.

protected LiveRef ref

Public Constructors

public UnicastRef ()

Create a new (empty) Unicast remote reference.

public UnicastRef (LiveRef liveRef)

Create a new Unicast RemoteRef.

Public Methods

public void done (RemoteCall call)

Done should only be called if the invoke returns successfully (non-exceptionally) to the stub. It allows the remote reference to clean up (or reuse) the connection.

Parameters
call object representing remote call

public LiveRef getLiveRef ()

Returns the current value of this UnicastRef's underlying LiveRef. NOTE: There is a JDK-internal dependency on the existence of this method (as it is inherited by UnicastRef) in the implementation of javax.management.remote.rmi.RMIConnector.

public String getRefClass (ObjectOutput out)

Returns the class of the ref type to be serialized

Parameters
out the output stream to which the reference will be serialized
Returns
  • the class name (without package qualification) of the reference type

public void invoke (RemoteCall call)

Invoke makes the remote call present in the RemoteCall object. 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.

Parameters
call object representing remote call
Throws
Exception

public Object invoke (Remote obj, Method method, Object[] params, long opnum)

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, marshalling 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.

Parameters
obj the proxy for the remote object
method the method to be invoked
params the parameter list
opnum a hash that may be used to represent the method
Returns
  • result of remote method invocation
Throws
Exception

public RemoteCall newCall (RemoteObject obj, Operation[] ops, int opnum, long hash)

Create an appropriate call object for a new call on this object. Passing operation array and index, allows the stubs generator to assign the operation indexes and interpret them. The RemoteRef may need the operation to encode in for the call.

Parameters
obj remote stub through which to make call
ops array of stub operations
opnum operation number
hash stub/skeleton interface hash
Returns
  • call object representing remote call

public void readExternal (ObjectInput in)

Read in external representation for remote ref.

Parameters
in the stream to read data from in order to restore the object
Throws
ClassNotFoundException If the class for an object being restored cannot be found.
IOException

public boolean remoteEquals (RemoteRef sub)

default implementation of equals for remote objects

Parameters
sub the Object to compare with
Returns
  • true if these Objects are equal; false otherwise.

public int remoteHashCode ()

default implementation of hashCode for remote objects

Returns
  • remote object hashcode

public String remoteToString ()

Method from object, forward from RemoteObject

Returns
  • string representing remote object reference

public void writeExternal (ObjectOutput out)

Write out external representation for remote ref.

Parameters
out the stream to write the object to
Throws
IOException

Protected Methods

protected void marshalCustomCallData (ObjectOutput out)

Throws
IOException

protected static void marshalValue (Class<?> type, Object value, ObjectOutput out)

Marshal value to an ObjectOutput sink using RMI's serialization format for parameters or return values.

Throws
IOException

protected static Object unmarshalValue (Class<?> type, ObjectInput in)

Unmarshal value from an ObjectInput source using RMI's serialization format for parameters or return values.