com.croftsoft.core.util.loop
Class Looper
java.lang.Object
com.croftsoft.core.util.loop.Looper
- All Implemented Interfaces:
- Commissionable, Destroyable, Initializable, Lifecycle, Resumable, Startable, Stoppable
public final class Looper
- extends Object
- implements Lifecycle
Periodically runs a task in a loop using a separate thread.
- Since:
- 2000-04-27
- Version:
- $Id: Looper.java,v 1.3 2008/09/20 05:01:27 croft Exp $
- Author:
- David Wallace Croft
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Looper
public Looper(Loopable loopable,
LoopGovernor loopGovernor,
ExceptionHandler exceptionHandler,
String threadName,
int threadPriority,
boolean useDaemonThread)
- Main constructor.
Call the start() method after construction to begin looping.
- Parameters:
loopable
- The loop() method of this object will be called periodically.
Looping will stop if this method returns false.exceptionHandler
- Handles all Exceptions generated by runnable.run().
The handleException() Object argument passed will be the loopable.
If null, the default behavior of printing any Exception to the
standard error output and stopping looping will be used.
Looper
public Looper(Loopable loopable)
setLoopGovernor
public void setLoopGovernor(LoopGovernor loopGovernor)
init
public void init()
- Specified by:
init
in interface Initializable
start
public void start()
- Specified by:
start
in interface Startable
stop
public void stop()
- Specified by:
stop
in interface Stoppable
destroy
public void destroy()
- Specified by:
destroy
in interface Destroyable
CroftSoft Core Javadoc (2008-09-28 20:58:02)