com.sun.jini.jeri.internal.runtime
Class AbstractDgcClient.EndpointEntry

java.lang.Object
  extended by com.sun.jini.jeri.internal.runtime.AbstractDgcClient.EndpointEntry
Enclosing class:
AbstractDgcClient

private final class AbstractDgcClient.EndpointEntry
extends Object

EndpointEntry encapsulates the client-side DGC information specific to a particular endpoint. Of most significance is the table that maps live reference objects to RefEntry objects and the renew/clean thread that handles asynchronous client-side DGC operations.


Nested Class Summary
private  class AbstractDgcClient.EndpointEntry.RefEntry
          RefEntry encapsulates the client-side DGC information specific to a particular object ID of an endpoint (a unique live reference value).
private  class AbstractDgcClient.EndpointEntry.RenewCleanThread
          RenewCleanThread handles the asynchronous client-side DGC activity for this entry: renewing the leases and making clean calls.
 
Field Summary
private  AbstractDgcClient.DgcProxy dgcProxy
          synthesized reference to the remote server-side DGC
private  long dirtyFailureDuration
          (average) elapsed time for recent failed dirty calls
private  int dirtyFailures
          count of recent dirty calls that have failed
private  long dirtyFailureStartTime
          absolute time of first recent failed dirty call
private  Object endpoint
          the endpoint that this EndpointEntry is for
private  long expirationTime
          absolute time current lease to this endpoint will expire
private  boolean interruptible
          true if renew/clean thread may be interrupted
private  Set invalidRefs
          set of RefEntry instances from last (failed) dirty call
private  Set pendingCleans
          set of clean calls that need to be made
private  ReferenceQueue refQueue
          reference queue for phantom references
private  Map refTable
          table of refs held for endpoint: maps object ID to RefEntry
private  boolean removed
          true if this entry has been removed from the global table
private  Thread renewCleanThread
          renew/clean thread for handling lease renewals and clean calls
private  long renewTime
          absolute time to renew current lease to this endpoint
 
Constructor Summary
private AbstractDgcClient.EndpointEntry(Object endpoint)
           
 
Method Summary
private  Object[] createObjectIDArray(Set refEntries)
          Creates an array of object IDs (needed for the DGC remote calls) from the ids in the given set of refs.
private  void makeCleanCalls()
          Makes all of the clean calls described by the clean requests in this entry's set of "pending cleans".
private  void makeDirtyCall(Set refEntries, long sequenceNum)
          Makes a DGC dirty call to this entry's endpoint, for the object IDs corresponding to the given set of refs and with the given sequence number.
private  void processPhantomRefs(AbstractDgcClient.EndpointEntry.RefEntry.PhantomLiveRef phantom)
          Processes the notification of the given phantom reference and any others that are on this entry's reference queue.
(package private)  boolean registerRefs(Collection refs)
          Registers the live reference instances in the supplied list to participate in distributed garbage collection.
private  void removeRefEntry(AbstractDgcClient.EndpointEntry.RefEntry refEntry)
          Removes the given RefEntry from the ref table.
private  void setRenewTime(long newRenewTime)
          Sets the absolute time at which the lease for this entry should be renewed.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

endpoint

private final Object endpoint
the endpoint that this EndpointEntry is for


dgcProxy

private final AbstractDgcClient.DgcProxy dgcProxy
synthesized reference to the remote server-side DGC


renewCleanThread

private final Thread renewCleanThread
renew/clean thread for handling lease renewals and clean calls


refQueue

private final ReferenceQueue refQueue
reference queue for phantom references


removed

private boolean removed
true if this entry has been removed from the global table


refTable

private final Map refTable
table of refs held for endpoint: maps object ID to RefEntry


invalidRefs

private Set invalidRefs
set of RefEntry instances from last (failed) dirty call


renewTime

private long renewTime
absolute time to renew current lease to this endpoint


expirationTime

private long expirationTime
absolute time current lease to this endpoint will expire


dirtyFailures

private int dirtyFailures
count of recent dirty calls that have failed


dirtyFailureStartTime

private long dirtyFailureStartTime
absolute time of first recent failed dirty call


dirtyFailureDuration

private long dirtyFailureDuration
(average) elapsed time for recent failed dirty calls


interruptible

private boolean interruptible
true if renew/clean thread may be interrupted


pendingCleans

private final Set pendingCleans
set of clean calls that need to be made

Constructor Detail

AbstractDgcClient.EndpointEntry

private AbstractDgcClient.EndpointEntry(Object endpoint)
Method Detail

registerRefs

boolean registerRefs(Collection refs)
Registers the live reference instances in the supplied list to participate in distributed garbage collection. This method returns false if this entry was removed from the global endpoint table (because it was empty) before these refs could be registered. In that case, a new EndpointEntry needs to be looked up. This method must NOT be invoked while synchronized on this EndpointEntry.


removeRefEntry

private void removeRefEntry(AbstractDgcClient.EndpointEntry.RefEntry refEntry)
Removes the given RefEntry from the ref table. If that makes the ref table empty, remove this entry from the global endpoint table. This method must ONLY be invoked while synchronized on this EndpointEntry.


makeDirtyCall

private void makeDirtyCall(Set refEntries,
                           long sequenceNum)
Makes a DGC dirty call to this entry's endpoint, for the object IDs corresponding to the given set of refs and with the given sequence number. This method must NOT be invoked while synchronized on this EndpointEntry.


setRenewTime

private void setRenewTime(long newRenewTime)
Sets the absolute time at which the lease for this entry should be renewed. This method must ONLY be invoked while synchronized on this EndpointEntry.


processPhantomRefs

private void processPhantomRefs(AbstractDgcClient.EndpointEntry.RefEntry.PhantomLiveRef phantom)
Processes the notification of the given phantom reference and any others that are on this entry's reference queue. Each phantom reference is removed from its RefEntry's ref set. All ref entries that have no more registered instances are collected into up to two batched clean call requests: one for refs requiring a "strong" clean call, and one for the rest. This method must ONLY be invoked while synchronized on this EndpointEntry.


makeCleanCalls

private void makeCleanCalls()
Makes all of the clean calls described by the clean requests in this entry's set of "pending cleans". Clean requests for clean calls that succeed are removed from the "pending cleans" set. This method must NOT be invoked while synchronized on this EndpointEntry.


createObjectIDArray

private Object[] createObjectIDArray(Set refEntries)
Creates an array of object IDs (needed for the DGC remote calls) from the ids in the given set of refs.



Copyright 2007-2010, multiple authors.
Licensed under the Apache License, Version 2.0, see the NOTICE file for attributions.