com.sun.jini.norm
Class LRMEventListener

java.lang.Object
  extended by java.lang.Thread
      extended by com.sun.jini.thread.InterruptedStatusThread
          extended by com.sun.jini.norm.LRMEventListener
All Implemented Interfaces:
Runnable, EventListener, DesiredExpirationListener, LeaseListener

 class LRMEventListener
extends InterruptedStatusThread
implements DesiredExpirationListener

Object that transfers events from the Lease Renewal Manager to the rest of Norm Server. Isolates the renewal manager from having to block on the snapshot locks.

Author:
Sun Microsystems, Inc.

Nested Class Summary
private static class LRMEventListener.Discriminator
          Trivial container class to tell us if we are processing the given wrapper because of a failure event or a desired expiration reached event.
 
Nested classes/interfaces inherited from class java.lang.Thread
Thread.State, Thread.UncaughtExceptionHandler
 
Field Summary
(package private) static LeaseDeniedException EXPIRED_SET_EXCEPTION
          Any events that hold this object are ignored
private static Logger logger
          Logger for logging messages for this class
private  Queue queue
          Queue we use to decouple the reception of events from the lease renewal manager from the scheduling of the sending of remote events and modifying our internal tables (which both require obtaining serious locks).
private  NormServerBaseImpl server
          Ref to the main server object which has all the top level methods
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
LRMEventListener(NormServerBaseImpl server)
          Simple constructor
 
Method Summary
 void expirationReached(LeaseRenewalEvent e)
          Method used to delivered desired expiration reached events.
 void notify(LeaseRenewalEvent e)
          Called by the LeaseRenewalManager when it cannot renew a lease that it is managing, and the lease's desired expiration time has not yet been reached.
 void run()
           
 
Methods inherited from class com.sun.jini.thread.InterruptedStatusThread
hasBeenInterrupted, interrupt
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, clone, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

logger

private static final Logger logger
Logger for logging messages for this class


server

private final NormServerBaseImpl server
Ref to the main server object which has all the top level methods


queue

private final Queue queue
Queue we use to decouple the reception of events from the lease renewal manager from the scheduling of the sending of remote events and modifying our internal tables (which both require obtaining serious locks).


EXPIRED_SET_EXCEPTION

static final LeaseDeniedException EXPIRED_SET_EXCEPTION
Any events that hold this object are ignored

Constructor Detail

LRMEventListener

LRMEventListener(NormServerBaseImpl server)
Simple constructor

Parameters:
server - Object that will make the actual internal updates and schedule the sending of remote events
Method Detail

notify

public void notify(LeaseRenewalEvent e)
Description copied from interface: LeaseListener
Called by the LeaseRenewalManager when it cannot renew a lease that it is managing, and the lease's desired expiration time has not yet been reached.

Note that, prior to invoking this method, the LeaseRenewalManager removes the affected lease from the managed set of leases. Note also that, because of the reentrancy guarantee made by the LeaseRenewalManager, new leases can be safely added by this method.

Specified by:
notify in interface LeaseListener
Parameters:
e - instance of LeaseRenewalEvent containing information about the lease that the LeaseRenewalManager was unable to renew, as well as information about the condition that made the LeaseRenewalManager fail to renew the lease

expirationReached

public void expirationReached(LeaseRenewalEvent e)
Description copied from interface: DesiredExpirationListener
Method used to delivered desired expiration reached events. The getException method of the passed event will always return null.

Note that, prior to invoking this method, the LeaseRenewalManager removes the affected lease from the managed set of leases. Note also that, because of the reentrancy guarantee made by the LeaseRenewalManager, it is safe to call back into the renewal manager from this method.

Specified by:
expirationReached in interface DesiredExpirationListener
Parameters:
e - instance of LeaseRenewalEvent containing information about the lease that was removed from the LeaseRenewalManager because its desired expiration was reached

run

public void run()
Specified by:
run in interface Runnable
Overrides:
run in class Thread


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