public class

UnicastServerRef

extends UnicastRef
implements ServerRef Dispatcher
java.lang.Object
   ↳ sun.rmi.server.UnicastRef
     ↳ sun.rmi.server.UnicastServerRef
Known Direct Subclasses
Known Indirect Subclasses

Class Overview

UnicastServerRef implements the remote reference layer server-side behavior for remote objects exported with the "UnicastRef" reference type.

Summary

[Expand]
Inherited Constants
From interface java.rmi.server.RemoteRef
From interface java.rmi.server.ServerRef
Fields
public static final Log callLog server call log
public static final boolean logCalls value of server call log property
[Expand]
Inherited Fields
From class sun.rmi.server.UnicastRef
Public Constructors
UnicastServerRef()
Create a new (empty) Unicast server remote reference.
UnicastServerRef(LiveRef ref)
Construct a Unicast server remote reference for a specified liveRef.
UnicastServerRef(int port)
Construct a Unicast server remote reference to be exported on the specified port.
UnicastServerRef(boolean forceStubUse)
Constructs a UnicastServerRef to be exported on an anonymous port (i.e., 0) and that uses a pregenerated stub class (NOT a dynamic proxy instance) if 'forceStubUse' is 'true'.
Public Methods
static void clearStackTraces(Throwable t)
Clear the stack trace of the given Throwable by replacing it with an empty StackTraceElement array, and do the same for all of its chained causative exceptions.
void dispatch(Remote obj, RemoteCall call)
Call to dispatch to the remote object (on the server side).
RemoteStub exportObject(Remote impl, Object data)
With the addition of support for dynamic proxies as stubs, this method is obsolete because it returns RemoteStub instead of the more general Remote.
Remote exportObject(Remote impl, Object data, boolean permanent)
Export this object, create the skeleton and stubs for this dispatcher.
String getClientHost()
Return the hostname of the current client.
String getRefClass(ObjectOutput out)
Returns the class of the ref type to be serialized.
void oldDispatch(Remote obj, RemoteCall call, int op)
Handle server-side dispatch using the RMI 1.1 stub/skeleton protocol, given a non-negative operation number that has already been read from the call stream.
void readExternal(ObjectInput in)
Read in external representation for remote ref.
void setSkeleton(Remote impl)
Discovers and sets the appropriate skeleton for the impl.
void writeExternal(ObjectOutput out)
Write out external representation for remote ref.
Protected Methods
RemoteRef getClientRef()
Return the client remote reference for this remoteRef.
void unmarshalCustomCallData(ObjectInput in)
[Expand]
Inherited Methods
From class sun.rmi.server.UnicastRef
From class java.lang.Object
From interface java.io.Externalizable
From interface java.rmi.server.RemoteRef
From interface java.rmi.server.ServerRef
From interface sun.rmi.server.Dispatcher

Fields

public static final Log callLog

server call log

public static final boolean logCalls

value of server call log property

Public Constructors

public UnicastServerRef ()

Create a new (empty) Unicast server remote reference.

public UnicastServerRef (LiveRef ref)

Construct a Unicast server remote reference for a specified liveRef.

public UnicastServerRef (int port)

Construct a Unicast server remote reference to be exported on the specified port.

public UnicastServerRef (boolean forceStubUse)

Constructs a UnicastServerRef to be exported on an anonymous port (i.e., 0) and that uses a pregenerated stub class (NOT a dynamic proxy instance) if 'forceStubUse' is 'true'. This constructor is only called by the method UnicastRemoteObject.exportObject(Remote) passing 'true' for 'forceStubUse'. The UnicastRemoteObject.exportObject(Remote) method returns RemoteStub, so it must ensure that the stub for the exported object is an instance of a pregenerated stub class that extends RemoteStub (instead of an instance of a dynamic proxy class which is not an instance of RemoteStub).

Public Methods

public static void clearStackTraces (Throwable t)

Clear the stack trace of the given Throwable by replacing it with an empty StackTraceElement array, and do the same for all of its chained causative exceptions.

public void dispatch (Remote obj, RemoteCall call)

Call to dispatch to the remote object (on the server side). The up-call to the server and the marshalling of return result (or exception) should be handled before returning from this method.

Parameters
obj the target remote object for the call
call the "remote call" from which operation and method arguments can be obtained.
Throws
IOException If unable to marshal return result or release input or output streams

public RemoteStub exportObject (Remote impl, Object data)

With the addition of support for dynamic proxies as stubs, this method is obsolete because it returns RemoteStub instead of the more general Remote. It should not be called. It sets the 'forceStubUse' flag to true so that the stub for the exported object is forced to be an instance of the pregenerated stub class, which extends RemoteStub. Export this object, create the skeleton and stubs for this dispatcher. Create a stub based on the type of the impl, initialize it with the appropriate remote reference. Create the target defined by the impl, dispatcher (this) and stub. Export that target via the Ref.

Parameters
impl the remote object implementation
data information necessary to export the object
Returns
  • the stub for the remote object

public Remote exportObject (Remote impl, Object data, boolean permanent)

Export this object, create the skeleton and stubs for this dispatcher. Create a stub based on the type of the impl, initialize it with the appropriate remote reference. Create the target defined by the impl, dispatcher (this) and stub. Export that target via the Ref.

public String getClientHost ()

Return the hostname of the current client. When called from a thread actively handling a remote method invocation the hostname of the client is returned.

Returns
  • the client's host name
Throws
ServerNotActiveException If called outside of servicing a remote method invocation.

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 oldDispatch (Remote obj, RemoteCall call, int op)

Handle server-side dispatch using the RMI 1.1 stub/skeleton protocol, given a non-negative operation number that has already been read from the call stream.

Parameters
obj the target remote object for the call
call the "remote call" from which operation and method arguments can be obtained.
op the operation number
Throws
IOException if unable to marshal return result or release input or output streams

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 void setSkeleton (Remote impl)

Discovers and sets the appropriate skeleton for the impl.

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 RemoteRef getClientRef ()

Return the client remote reference for this remoteRef. In the case of a client RemoteRef "this" is the answer. For a server remote reference, a client side one will have to found or created.

protected void unmarshalCustomCallData (ObjectInput in)