uka.karmi.rmi
Class ProxyServerRef

java.lang.Object
  extended byuka.karmi.rmi.server.RemoteServerRef
      extended byuka.karmi.rmi.ProxyServerRef

public class ProxyServerRef
extends RemoteServerRef

A proxy for a remote object. A proxy holds a SingleRemoteClientRef and prevents this reference from being garbage collected. If a server is addressable in technology A and a client in technology B wants to access this server, a proxy on a JVM with both technologies must be used. The technology B client gets a reference to the proxy. The proxy receives the call and forwards it to the server. Sometimes a proxy is only necessary for the DGC. This is the case when a remote reference from DGC technology A is needed in technology B. Then a proxy is required even if the server object can be address via technology A and technology B.

Author:
Christian Nester, Bernhard Haumacher

Field Summary
private  SingleRemoteClientRef clientRef
          The proxy keeps a reference to this remote reference to prevent it from being garbage collected.
private  RemoteSkeleton skel
          A skeleton that is stacked on a stub instead of a server implementation.
private  RemoteStub stub
           
 
Fields inherited from class uka.karmi.rmi.server.RemoteServerRef
callCounter, ep, objectId, objectId2
 
Constructor Summary
ProxyServerRef(SingleRemoteClientRef clientRef)
          Create an unexported server reference to a proxy for the given client reference.
 
Method Summary
 void doApplicationCall(ServerConnection c)
          The entry-point into the method dispatch process.
 RemoteStub getStub()
          Returns null.
 boolean remoteEquals(RemoteStub obj)
          ProxyServerRef objects are never visible in the Stub/Skeleton layer.
 void synchronize(RMACallback cb)
           
 java.lang.String toStringMembers()
           
 void unreferenced()
          Called whenever the last remote reference to this server implementation is garbage collected.
 
Methods inherited from class uka.karmi.rmi.server.RemoteServerRef
createSkeletonFor, createStubFor, decCallCounter, getClientHost, incCallCounter, newInstanceRelative, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

clientRef

private SingleRemoteClientRef clientRef
The proxy keeps a reference to this remote reference to prevent it from being garbage collected. Method invocations to this proxy are forwarded to the server implementation referenced by this client reference.


stub

private RemoteStub stub
See Also:
skel

skel

private RemoteSkeleton skel
A skeleton that is stacked on a stub instead of a server implementation. It can be used to forward method invocations to the encapsulated clientRef. This skeleton is initialized lazily, because it is only required, if this proxy is actually used for communication.

See Also:
stub
Constructor Detail

ProxyServerRef

public ProxyServerRef(SingleRemoteClientRef clientRef)
               throws RemoteException
Create an unexported server reference to a proxy for the given client reference.

Method Detail

doApplicationCall

public void doApplicationCall(ServerConnection c)
                       throws java.io.IOException,
                              java.lang.ClassNotFoundException
Description copied from class: RemoteServerRef
The entry-point into the method dispatch process. This method is called from the dispatch() method of the server connection. The actual dispatch is done in a sub-class of RemoteServerRef. This abstract method is implemented for unicast servers in the UnicastRemoteServerRef class.

Specified by:
doApplicationCall in class RemoteServerRef
Parameters:
c - the connection, the call came in
Throws:
java.io.IOException
java.lang.ClassNotFoundException
See Also:
ServerConnection.dispatch(boolean), UnicastRemoteServerRef.doApplicationCall(ServerConnection)

unreferenced

public void unreferenced()
Description copied from class: RemoteServerRef
Called whenever the last remote reference to this server implementation is garbage collected.

Specified by:
unreferenced in class RemoteServerRef
See Also:
Unreferenced

getStub

public RemoteStub getStub()
Returns null. Proxy objects don't have stubs.

Specified by:
getStub in class RemoteServerRef

synchronize

public void synchronize(RMACallback cb)
                 throws java.lang.Throwable
Specified by:
synchronize in class RemoteServerRef
Throws:
java.lang.Throwable

remoteEquals

public boolean remoteEquals(RemoteStub obj)
ProxyServerRef objects are never visible in the Stub/Skeleton layer. They don't have skeletons and so remoteEquals is never called.

Specified by:
remoteEquals in class RemoteServerRef

toStringMembers

public java.lang.String toStringMembers()
Overrides:
toStringMembers in class RemoteServerRef