uka.karmi.rmi
Class DGCMarshalContext

java.lang.Object
  extended byuka.karmi.rmi.DGCMarshalContext
Direct Known Subclasses:
HierarchicalDGC.MarshalContext, NoDGC.MarshalContext

public abstract class DGCMarshalContext
extends java.lang.Object

DGCMarshalContext is the base class for distributed garbage collectors.

A DGCContext is used during a remote method invocation in connection with a marshal output stream. Whenever a reference to a remote object is marshaled, the corresponding method localReferenceMarshaled() or remoteReferenceMarshaled() is invoked on the DGCMarshalContext.

If the returned value is true, reset is called after the remote garbage collector has acknowledged that all marshaled references have connected to the remote garbage collector. If the returned value is false, reset can be called immediately.

This class provides an interface to the DGC algorithm during object serialization. It allows to install an additional acknowledgement policy in conjunction with an alternative garbage collection algorithm.

Note: DGCMarshalContext always cooperates with a DGCUnmarshalContext on the remote side. Both objects are created in the factory methods of the DGC algorithm class that is installed on both nodes. The required acknowledgement policy of both contexts must match and either both require an acknowledgement messsage or not.

For DGCContexts there is no difference between sending arguments or results in a remote method call.

Author:
Christian Nester, Bernhard Haumacher

Constructor Summary
DGCMarshalContext()
           
 
Method Summary
abstract  boolean done()
          Called when all objects of a call are marshaled to the stream.
abstract  java.lang.Object localReferenceMarshaled(SingleRemoteClientRef ref, RemoteServerRef dgcObject)
          Called by a remote reference while it is serialized to a marshal stream and the dgc object for the resulting object is a local DGC.
abstract  boolean proxyRequired(SingleRemoteClientRef ref)
          Decides whether a proxy is required for DGC purpose only.
abstract  java.lang.Object remoteReferenceMarshaled(SingleRemoteClientRef ref)
          Called by a remote reference while it is serialized and the dgc object for the resulting object is no local DGC.
abstract  void reset()
          Reset context for reuse
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DGCMarshalContext

public DGCMarshalContext()
Method Detail

localReferenceMarshaled

public abstract java.lang.Object localReferenceMarshaled(SingleRemoteClientRef ref,
                                                         RemoteServerRef dgcObject)
Called by a remote reference while it is serialized to a marshal stream and the dgc object for the resulting object is a local DGC.

Returns:
a new dgcInfo object

remoteReferenceMarshaled

public abstract java.lang.Object remoteReferenceMarshaled(SingleRemoteClientRef ref)
Called by a remote reference while it is serialized and the dgc object for the resulting object is no local DGC.

Returns:
a new dgcInfo object

proxyRequired

public abstract boolean proxyRequired(SingleRemoteClientRef ref)
Decides whether a proxy is required for DGC purpose only. If a remote reference is marshaled to another VM, and the server implementation is proven to be accessible from that VM, the DGC can still request to build a proxy.

See Also:
SingleRemoteClientRef.writeExternal(java.io.ObjectOutput)

done

public abstract boolean done()
Called when all objects of a call are marshaled to the stream.

Returns:
whether the DGC algorithm needs a notification about the successful arrival of the remote reference at the remote address space. A reference has arrived successfully, if it has connected to the garbage collector on the remote side.

reset

public abstract void reset()
Reset context for reuse