com.tivoli.twg.libs
Class GenericPoller

java.lang.Object
  extended bycom.tivoli.twg.libs.GenericPoller
All Implemented Interfaces:
java.lang.Runnable

public class GenericPoller
extends java.lang.Object
implements java.lang.Runnable

This class allows objects implementing the GenericWaiter interface to wait for an asynchonous event or state change without incurring the expense of an extra thread. This class maintains a thread that processes a list of waiters.


Field Summary
static int INFINITE
           
protected  java.lang.Thread myThread
           
 
Method Summary
 void run()
           
static void wait(GenericWaiter waiter, int interval, int retries)
          This method adds a GenericWaiter to the poller's list.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

INFINITE

public static final int INFINITE
See Also:
Constant Field Values

myThread

protected java.lang.Thread myThread
Method Detail

wait

public static void wait(GenericWaiter waiter,
                        int interval,
                        int retries)
This method adds a GenericWaiter to the poller's list.

Parameters:
waiter - GenericWaiter object to be added to the poller's list.
interval - the retry interval in milliseconds. If this value is zero, a default of 1 second (i.e. 1000) is used.
retries - the number of times to retry for the event. Use GenericPoller.INFINITE for waiters that should wait indefinitely.

run

public void run()
Specified by:
run in interface java.lang.Runnable