APIdia Launch Partner
Top Description Inners Fields Constructors Methods
sun.rmi.server

public Class UnicastServerRef

extends UnicastRef
implements ServerRef, Dispatcher
Class Inheritance
All Implemented Interfaces
sun.rmi.server.Dispatcher, java.rmi.server.ServerRef, java.rmi.server.RemoteRef, java.io.Externalizable, java.io.Serializable
Known Direct Subclasses
sun.rmi.server.UnicastServerRef2
Annotations
@SuppressWarnings:deprecation
Imports
java.io.IOException, .ObjectInput, .ObjectInputFilter, .ObjectInputStream, .ObjectOutput, java.lang.reflect.InvocationTargetException, .Method, java.rmi.AccessException, .MarshalException, .Remote, .RemoteException, .ServerError, .ServerException, .UnmarshalException, java.rmi.server.ExportException, .Operation, .RemoteCall, .RemoteRef, .RemoteStub, .ServerNotActiveException, .ServerRef, .Skeleton, .SkeletonNotFoundException, java.util.Collections, .Date, .HashMap, .Map, .WeakHashMap, sun.rmi.runtime.Log, sun.rmi.transport.LiveRef, .StreamRemoteCall, .Target, sun.rmi.transport.tcp.TCPTransport

References Deprecated

ServerRef is deprecated or references (maybe indirectly) at least one deprecated element.

See corresponding docs for further information.

UnicastServerRef implements the remote reference layer server-side behavior for remote objects exported with the "UnicastRef" reference type. If an ObjectInputFilter is supplied it is invoked during deserialization to filter the arguments, otherwise the default filter of ObjectInputStream applies.
Authors
Ann Wollrath, Roger Riggs, Peter Jones

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class
UnicastServerRef.HashToMethod_Maps

A weak hash map, mapping classes to hash maps that map method hashes to method objects.

Field Summary

Modifier and TypeField and Description
public static final Log
callLog

server call log

private final transient ObjectInputFilter
private boolean
private transient Map<Long, Method>
hashToMethod_Map

maps method hash to Method object for each remote method

private static final WeakClassHashMap<Map<Long, Method>>
hashToMethod_Maps

A weak hash map, mapping classes to hash maps that map method hashes to method objects.

public static final boolean
logCalls

value of server call log property

private static final long
private transient Skeleton
skel

References Deprecated Skeleton is deprecated or references (maybe indirectly) at least one deprecated element.
skeleton to dispatch remote calls through, for 1.1 stub protocol (may be null if stub class only uses 1.2 stub protocol)
private static final boolean
suppressStackTraces

flag to remove server-side stack traces before marshalling exceptions thrown by remote invocations to this VM

private static final boolean
wantExceptionLog

flag to enable writing exceptions to System.err

private static final Map<Class<?>, ?>
withoutSkeletons

cache of impl classes that have no corresponding skeleton class

Inherited from sun.rmi.server.UnicastRef:
clientCallLogclientRefLogref

Constructor Summary

AccessConstructor and Description
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(LiveRef ref, ObjectInputFilter filter)

Construct a Unicast server remote reference for a specified liveRef and filter.

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'.

Method Summary

Modifier and TypeMethod and Description
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
the target remote object for the call
obj
,
RemoteCall
the "remote call" from which operation and method arguments can be obtained.
call
)

Implements sun.rmi.server.Dispatcher.dispatch.

References Deprecated RemoteCall is deprecated or references (maybe indirectly) at least one deprecated element.

Call to dispatch to the remote object (on the server side).

public RemoteStub
exportObject(Remote impl, Object data)

Implements java.rmi.server.ServerRef.exportObject.

References Deprecated RemoteStub is deprecated or references (maybe indirectly) at least one deprecated element.

With the addition of support for dynamic proxies as stubs, this method is obsolete because it returns RemoteStub instead of the more general Remote.

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

Export this object, create the skeleton and stubs for this dispatcher.

public String
getClientHost()

Implements java.rmi.server.ServerRef.getClientHost.

Return the hostname of the current client.

protected RemoteRef
getClientRef()

Return the client remote reference for this remoteRef.

public String
getRefClass(ObjectOutput out)

Overrides sun.rmi.server.UnicastRef.getRefClass.

Implements java.rmi.server.RemoteRef.getRefClass.

Returns the class of the ref type to be serialized.

private void
logCall(Remote obj, Object method)

Log the details of an incoming call.

private void
logCallException(Throwable e)

Log the exception detail of an incoming call.

private void
oldDispatch(Remote
the target remote object for the call
obj
,
RemoteCall
the "remote call" from which operation and method arguments can be obtained.
call
,
int
the operation number
op
)
References Deprecated RemoteCall is deprecated or references (maybe indirectly) at least one deprecated element.

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

public void
readExternal(ObjectInput in)

Overrides sun.rmi.server.UnicastRef.readExternal.

Implements java.io.Externalizable.readExternal.

Read in external representation for remote ref.

public void
setSkeleton(Remote impl)

Discovers and sets the appropriate skeleton for the impl.

protected void
unmarshalCustomCallData(ObjectInput in)

Sets a filter for invocation arguments, if a filter has been set.

public void
writeExternal(ObjectOutput out)

Overrides sun.rmi.server.UnicastRef.writeExternal.

Implements java.io.Externalizable.writeExternal.

Write out external representation for remote ref.

Inherited from sun.rmi.server.UnicastRef:
donegetLiveRefinvokeinvokelogClientCallmarshalCustomCallDatamarshalValuenewCallremoteEqualsremoteHashCoderemoteToStringunmarshalValue

Field Detail

callLogback to summary
public static final Log callLog

server call log

filterback to summary
private final transient ObjectInputFilter filter
forceStubUseback to summary
private boolean forceStubUse
hashToMethod_Mapback to summary
private transient Map<Long, Method> hashToMethod_Map

maps method hash to Method object for each remote method

hashToMethod_Mapsback to summary
private static final WeakClassHashMap<Map<Long, Method>> hashToMethod_Maps

A weak hash map, mapping classes to hash maps that map method hashes to method objects.

logCallsback to summary
public static final boolean logCalls

value of server call log property

serialVersionUIDback to summary
private static final long serialVersionUID

Hides sun.rmi.server.UnicastRef.serialVersionUID, java.rmi.server.ServerRef.serialVersionUID, java.rmi.server.RemoteRef.serialVersionUID.

skelback to summary
private transient Skeleton skel

References Deprecated

Skeleton is deprecated or references (maybe indirectly) at least one deprecated element.

See corresponding docs for further information.

skeleton to dispatch remote calls through, for 1.1 stub protocol (may be null if stub class only uses 1.2 stub protocol)

suppressStackTracesback to summary
private static final boolean suppressStackTraces

flag to remove server-side stack traces before marshalling exceptions thrown by remote invocations to this VM

wantExceptionLogback to summary
private static final boolean wantExceptionLog

flag to enable writing exceptions to System.err

withoutSkeletonsback to summary
private static final Map<Class<?>, ?> withoutSkeletons

cache of impl classes that have no corresponding skeleton class

Constructor Detail

UnicastServerRefback to summary
public UnicastServerRef()

Create a new (empty) Unicast server remote reference. The filter is null to defer to the default ObjectInputStream filter, if any.

UnicastServerRefback to summary
public UnicastServerRef(LiveRef ref)

Construct a Unicast server remote reference for a specified liveRef. The filter is null to defer to the default ObjectInputStream filter, if any.

UnicastServerRefback to summary
public UnicastServerRef(LiveRef ref, ObjectInputFilter filter)

Construct a Unicast server remote reference for a specified liveRef and filter.

UnicastServerRefback to summary
public UnicastServerRef(int port)

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

UnicastServerRefback to summary
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).

Method Detail

clearStackTracesback to summary
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.

dispatchback to summary
public void dispatch(Remote obj, RemoteCall call) throws IOException

Implements sun.rmi.server.Dispatcher.dispatch.

References Deprecated

RemoteCall is deprecated or references (maybe indirectly) at least one deprecated element.

See corresponding docs for further information.

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:Remote

the target remote object for the call

call:RemoteCall

the "remote call" from which operation and method arguments can be obtained.

Exceptions
IOException:
If unable to marshal return result or release input or output streams
exportObjectback to summary
public RemoteStub exportObject(Remote impl, Object data) throws RemoteException

Implements java.rmi.server.ServerRef.exportObject.

References Deprecated

RemoteStub is deprecated or references (maybe indirectly) at least one deprecated element.

See corresponding docs for further information.

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.

Exceptions
RemoteException:

Doc from java.rmi.server.ServerRef.exportObject.

if an exception occurs attempting to export the object (e.g., stub class could not be found)

exportObjectback to summary
public Remote exportObject(Remote impl, Object data, boolean permanent) throws RemoteException

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.

getClientHostback to summary
public String getClientHost() throws ServerNotActiveException

Implements java.rmi.server.ServerRef.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.

Exceptions
ServerNotActiveException:
If called outside of servicing a remote method invocation.
getClientRefback to summary
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.

getRefClassback to summary
public String getRefClass(ObjectOutput out)

Overrides sun.rmi.server.UnicastRef.getRefClass.

Implements java.rmi.server.RemoteRef.getRefClass.

Returns the class of the ref type to be serialized.

logCallback to summary
private void logCall(Remote obj, Object method)

Log the details of an incoming call. The method parameter is either of type java.lang.reflect.Method or java.rmi.server.Operation.

logCallExceptionback to summary
private void logCallException(Throwable e)

Log the exception detail of an incoming call.

oldDispatchback to summary
private void oldDispatch(Remote obj, RemoteCall call, int op) throws Exception

References Deprecated

RemoteCall is deprecated or references (maybe indirectly) at least one deprecated element.

See corresponding docs for further information.

Handle server-side dispatch using the RMI 1.1 stub/skeleton protocol, given a non-negative operation number or negative method hash that has already been read from the call stream. Exceptions are handled by the caller to be sent to the remote client.

Parameters
obj:Remote

the target remote object for the call

call:RemoteCall

the "remote call" from which operation and method arguments can be obtained.

op:int

the operation number

Exceptions
Exception:
if unable to marshal return result or release input or output streams
readExternalback to summary
public void readExternal(ObjectInput in) throws IOException, ClassNotFoundException

Overrides sun.rmi.server.UnicastRef.readExternal.

Implements java.io.Externalizable.readExternal.

Read in external representation for remote ref.

Exceptions
IOException:

Doc from java.io.Externalizable.readExternal.

if I/O errors occur

ClassNotFoundException:
If the class for an object being restored cannot be found.
setSkeletonback to summary
public void setSkeleton(Remote impl) throws RemoteException

Discovers and sets the appropriate skeleton for the impl.

unmarshalCustomCallDataback to summary
protected void unmarshalCustomCallData(ObjectInput in) throws IOException, ClassNotFoundException

Sets a filter for invocation arguments, if a filter has been set. Called by dispatch before the arguments are read.

writeExternalback to summary
public void writeExternal(ObjectOutput out) throws IOException

Overrides sun.rmi.server.UnicastRef.writeExternal.

Implements java.io.Externalizable.writeExternal.

Write out external representation for remote ref.

Exceptions
IOException:

Doc from java.io.Externalizable.writeExternal.

Includes any I/O exceptions that may occur

sun.rmi.server back to summary

private Class UnicastServerRef.HashToMethod_Maps

extends WeakClassHashMap<Map<Long, Method>>
Class Inheritance

A weak hash map, mapping classes to hash maps that map method hashes to method objects.

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
protected Map<Long, Method>
Inherited from sun.rmi.server.WeakClassHashMap:
get

Constructor Detail

HashToMethod_Mapsback to summary
pack-priv HashToMethod_Maps()

Method Detail

computeValueback to summary
protected Map<Long, Method> computeValue(Class<?> remoteClass)

Implements abstract sun.rmi.server.WeakClassHashMap.computeValue.