uka.karmi.dgc
Class HierarchicalDGC.MarshalContext

java.lang.Object
  extended byuka.karmi.rmi.DGCMarshalContext
      extended byuka.karmi.dgc.HierarchicalDGC.MarshalContext
Enclosing class:
HierarchicalDGC

final class HierarchicalDGC.MarshalContext
extends DGCMarshalContext

Marshaling context for a hierarchical DGC implementation. The MarshalContext increases a counter to a local proxy when a reference is marshaled to a remote address space.

Author:
Bernhard Haumacher, Christian Nester

Constructor Summary
(package private) HierarchicalDGC.MarshalContext()
           
 
Method Summary
 boolean done()
          Called when all objects of a call are marshaled to the stream.
 java.lang.Object localReferenceMarshaled(SingleRemoteClientRef ref, RemoteServerRef serverRef)
          Called during marshaling of a remote reference, if the responsible DGC object is local.
 boolean proxyRequired(SingleRemoteClientRef ref)
          This DGC implementation requires a proxy for each marshaled reference.
 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.
 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

HierarchicalDGC.MarshalContext

HierarchicalDGC.MarshalContext()
Method Detail

localReferenceMarshaled

public java.lang.Object localReferenceMarshaled(SingleRemoteClientRef ref,
                                                RemoteServerRef serverRef)
Called during marshaling of a remote reference, if the responsible DGC object is local.

Specified by:
localReferenceMarshaled in class DGCMarshalContext
Returns:
a new dgcInfo object
See Also:
SingleRemoteClientRef.writeExternal(java.io.ObjectOutput)

remoteReferenceMarshaled

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

Specified by:
remoteReferenceMarshaled in class DGCMarshalContext
Returns:
a new dgcInfo object

done

public boolean done()
Description copied from class: DGCMarshalContext
Called when all objects of a call are marshaled to the stream.

Specified by:
done in class DGCMarshalContext
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 void reset()
Description copied from class: DGCMarshalContext
Reset context for reuse

Specified by:
reset in class DGCMarshalContext

proxyRequired

public boolean proxyRequired(SingleRemoteClientRef ref)
This DGC implementation requires a proxy for each marshaled reference. This avoids registering references at the original location. The proxy is garbage collected, when all references to it are collected. Since the proxy holds a reference to the currently marshaled SingleRemoteClientRef, this remote reference only dies, when its proxy dies. The result is a hierarchical garbage collection scheme, where remote references to other remote references exist. These linked references are only used for reference counting, not used for access. Method calls to the referenced object use direct references when possible.

Specified by:
proxyRequired in class DGCMarshalContext
See Also:
DGCMarshalContext.proxyRequired(SingleRemoteClientRef)