uka.karmi.rmi
Class DGCUnmarshalContext

java.lang.Object
  extended byuka.karmi.rmi.DGCUnmarshalContext
Direct Known Subclasses:
HierarchicalDGC.UnmarshalContext, NoDGC.UnmarshalContext

public abstract class DGCUnmarshalContext
extends java.lang.Object

Base class for distributed garbage collectors. A DGCContext is used during a remote method invocation. A DGCUnmarshalContext object is used in connection with a marshal input stream. Whenever a remote reference is unmarshaled, a corresponding method is invoked on the DGCUnmarshalContext.

When all objects are received reset() is called. The context has to return a boolean value. True, if the DGCMarshalContext on the other side has to be notified that the unmarshaled references have connected to their garbage collector. False, if no notification is necessary. Connecting references to their DGC must be completed when the reset() method returns.

The idea behind this class is to provide a connection to the DGC algorithm during deserialization and to allow an additional acknowledgement to deal with races. Note that ALWAYS a DGCMarshalContext works with a DGCUnmarshalContext on the remote machine. Both objects are created with the factory methods of the same DGC class. Both objects must ALWAYS come to the same result if an additional acknowledgement is required or not. It is not allowed that one object wants an acknowledgement and the other doesn't. For DGCContexts there is no difference between sending arguments or results in a remote method call.

The context has to be reset before reusing it.

Author:
Christian Nester, Bernhard Haumacher

Constructor Summary
DGCUnmarshalContext()
           
 
Method Summary
abstract  void localReferenceUnmarshaled(SingleRemoteClientRef ref)
          Called by a SingleRemoteClientRef object if it is deserialized and the dgc object is local.
abstract  void remoteReferenceUnmarshaled(SingleRemoteClientRef ref)
          Called by a SingleRemoteClientRef object if it is deserialized and the dgc object is not local.
abstract  boolean reset()
          Reset method.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DGCUnmarshalContext

public DGCUnmarshalContext()
Method Detail

remoteReferenceUnmarshaled

public abstract void remoteReferenceUnmarshaled(SingleRemoteClientRef ref)
Called by a SingleRemoteClientRef object if it is deserialized and the dgc object is not local.


localReferenceUnmarshaled

public abstract void localReferenceUnmarshaled(SingleRemoteClientRef ref)
Called by a SingleRemoteClientRef object if it is deserialized and the dgc object is local.


reset

public abstract boolean reset()
Reset method. When the reset() method returns all received remote references are registered with the DGC algorithm. It returns true if an ACK Message must be sent to the sender. The reset() method and the corresponding done() method on the sending side must return the same value. That means that sender and receiver must always agree if an ACK message is required or not. This method also resets the context so that it can be reused.

Returns:
true, if an acknowledgement must be sent