ucar.unidata.util
Class Poller

java.lang.Object
  extended by ucar.unidata.util.Poller
All Implemented Interfaces:
Runnable
Direct Known Subclasses:
FilePoller

public abstract class Poller
extends Object
implements Runnable

Class to handle polling.

Version:
$Revision: 1.17 $ $Date: 2006/05/05 19:19:36 $
Author:
Metapps development team

Field Summary
static boolean debug
          Debug flag
protected  long interval
          interval for polling (milliseconds)
protected  ActionListener listener
          listener for polling events
protected  boolean running
          flag for running
 
Constructor Summary
Poller(ActionListener listener, long interval)
          Create a Poller
Poller(long interval)
          Create a Poller
 
Method Summary
protected abstract  void doPoll()
          This method does the work.
 long getInterval()
          Get the polling interval
 void init()
          Initialize.
 void run()
          Run the poller
 void stopRunning()
          Stop polling.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

debug

public static boolean debug
Debug flag


listener

protected ActionListener listener
listener for polling events


interval

protected long interval
interval for polling (milliseconds)


running

protected boolean running
flag for running

Constructor Detail

Poller

public Poller(long interval)
Create a Poller

Parameters:
interval - polling interval

Poller

public Poller(ActionListener listener,
              long interval)
Create a Poller

Parameters:
listener - listener for events
interval - polling interval
Method Detail

init

public void init()
Initialize.


run

public void run()
Run the poller

Specified by:
run in interface Runnable

doPoll

protected abstract void doPoll()
This method does the work. Subclasses implement what they want.


stopRunning

public void stopRunning()
Stop polling.


getInterval

public long getInterval()
Get the polling interval

Returns:
the interval (milliseconds)