org.glassfish.grizzly.util.conditions
Class ConditionListener<K,L>

java.lang.Object
  extended by org.glassfish.grizzly.util.conditions.ConditionListener<K,L>
Direct Known Subclasses:
DefaultConditionListener

public abstract class ConditionListener<K,L>
extends Object

Common ConditionListener class, which could be used with StateHolder, to register custom conditions. On each state change - condition will be checked, if it's true - Condition's listener will be notified.

Author:
oleksiys

Field Summary
protected  Condition<K> condition
           
protected  boolean keepAlive
           
protected  L notificationObject
           
 
Constructor Summary
ConditionListener()
           
ConditionListener(Condition<K> condition, L notificationObject)
           
 
Method Summary
 boolean checkConditionAndNotify(K state)
           
 Condition<K> getCondition()
           
 L getNotificationObject()
           
 boolean isKeepAlive()
           
protected abstract  void notifyListener()
           
 void set(Condition<K> condition, L notificationObject)
           
 void setCondition(Condition<K> condition)
           
 void setKeepAlive(boolean keepAlive)
           
 void setNotificationObject(L notificationObject)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

condition

protected Condition<K> condition

notificationObject

protected L notificationObject

keepAlive

protected boolean keepAlive
Constructor Detail

ConditionListener

public ConditionListener()

ConditionListener

public ConditionListener(Condition<K> condition,
                         L notificationObject)
Method Detail

notifyListener

protected abstract void notifyListener()

set

public void set(Condition<K> condition,
                L notificationObject)

getCondition

public Condition<K> getCondition()

setCondition

public void setCondition(Condition<K> condition)

getNotificationObject

public L getNotificationObject()

setNotificationObject

public void setNotificationObject(L notificationObject)

checkConditionAndNotify

public boolean checkConditionAndNotify(K state)

isKeepAlive

public boolean isKeepAlive()

setKeepAlive

public void setKeepAlive(boolean keepAlive)


Copyright © 2009 SUN Microsystems. All Rights Reserved.