com.sun.jini.mahalo
Class LeaseExpirationMgr

java.lang.Object
  extended by com.sun.jini.mahalo.LeaseExpirationMgr
All Implemented Interfaces:
WeakTable.KeyGCHandler, LeaseManager

 class LeaseExpirationMgr
extends Object
implements LeaseManager, WeakTable.KeyGCHandler

Lease Mgr implementation that aggressively expires leases as they expiration times occur. Synchronizes on resource before canceling it.

Author:
Sun Microsystems, Inc.
See Also:
LeaseManager

Nested Class Summary
private  class LeaseExpirationMgr.Canceler
          Objects that do the actually cancel the resource in question, stuck in WakeupManager
(package private) static interface LeaseExpirationMgr.Expirer
          Interface that allows LeaseExpirationMgr to expire resources.
 
Field Summary
private  WakeupManager expirationQueue
           
private  LeaseExpirationMgr.Expirer landlord
           
private  WeakTable ticketMap
           
 
Constructor Summary
LeaseExpirationMgr(LeaseExpirationMgr.Expirer landlord)
          Create a LeaseExpirationMgr to aggressively expire the leases of the passed landlord (implementing Expirer is trivial for a Landlord.
 
Method Summary
 void keyGC(Object value)
          Called by WeakTable when it notices that a key has been collected and the value still exists.
 void register(LeasedResource resource)
          Notifies the manager of a new lease being created.
 void renewed(LeasedResource resource)
          Notifies the manager of a lease being renewed.
private  void schedule(LeasedResource resource)
          Schedule a leased resource to be reaped in the future.
(package private)  void terminate()
          Terminate the LeaseExpirationMgr, killing any threads it has started
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ticketMap

private WeakTable ticketMap

landlord

private LeaseExpirationMgr.Expirer landlord

expirationQueue

private WakeupManager expirationQueue
Constructor Detail

LeaseExpirationMgr

LeaseExpirationMgr(LeaseExpirationMgr.Expirer landlord)
Create a LeaseExpirationMgr to aggressively expire the leases of the passed landlord (implementing Expirer is trivial for a Landlord.

Method Detail

terminate

void terminate()
Terminate the LeaseExpirationMgr, killing any threads it has started


register

public void register(LeasedResource resource)
Description copied from interface: LeaseManager
Notifies the manager of a new lease being created.

Specified by:
register in interface LeaseManager
Parameters:
resource - The resource associated with the new Lease.

renewed

public void renewed(LeasedResource resource)
Description copied from interface: LeaseManager
Notifies the manager of a lease being renewed.

Specified by:
renewed in interface LeaseManager
Parameters:
resource - The resource associated with the new Lease.

schedule

private void schedule(LeasedResource resource)
Schedule a leased resource to be reaped in the future. Called when a resource gets a lease, or a lease is renewed.


keyGC

public void keyGC(Object value)
Description copied from interface: WeakTable.KeyGCHandler
Called by WeakTable when it notices that a key has been collected and the value still exists.

Specified by:
keyGC in interface WeakTable.KeyGCHandler
Parameters:
value - The value associated with the collected key


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