net.sourceforge.hiveutils.service.impl
Class AsynchronousTaskPerformerImpl

java.lang.Object
  extended by net.sourceforge.hiveutils.service.impl.AsynchronousTaskPerformerImpl
All Implemented Interfaces:
java.lang.Runnable, java.util.EventListener, AsynchronousTaskPerformer, org.apache.hivemind.events.RegistryShutdownListener

public class AsynchronousTaskPerformerImpl
extends java.lang.Object
implements AsynchronousTaskPerformer, org.apache.hivemind.events.RegistryShutdownListener, java.lang.Runnable

Implementation of the Asynchroneous task performer service.

Author:
Jean-Francois Poilpret

Constructor Summary
AsynchronousTaskPerformerImpl(org.apache.commons.logging.Log logger, long waitTime, int minTasks)
           
 
Method Summary
 void addTask(java.lang.Runnable task)
          Add a task to be executed asynchroneously.
 void executeNow()
          This method forces execution of all pending tasks.
 void executeNowAndWait()
          This method forces execution of all pending tasks.
 void registryDidShutdown()
           
 void run()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AsynchronousTaskPerformerImpl

public AsynchronousTaskPerformerImpl(org.apache.commons.logging.Log logger,
                                     long waitTime,
                                     int minTasks)
Method Detail

registryDidShutdown

public void registryDidShutdown()
Specified by:
registryDidShutdown in interface org.apache.hivemind.events.RegistryShutdownListener

addTask

public void addTask(java.lang.Runnable task)
Description copied from interface: AsynchronousTaskPerformer
Add a task to be executed asynchroneously.

Specified by:
addTask in interface AsynchronousTaskPerformer
Parameters:
task - task to be added to the list of asynchroneous tasks

executeNowAndWait

public void executeNowAndWait()
Description copied from interface: AsynchronousTaskPerformer
This method forces execution of all pending tasks. Note that the method waits until all pending tasks have finished executing before it returns.

Specified by:
executeNowAndWait in interface AsynchronousTaskPerformer

executeNow

public void executeNow()
Description copied from interface: AsynchronousTaskPerformer
This method forces execution of all pending tasks. Note that the method does not wait until all pending tasks have finished executing before it returns.

Specified by:
executeNow in interface AsynchronousTaskPerformer

run

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