org.jacorb.notification.engine
Class DefaultTaskProcessor

java.lang.Object
  extended byorg.jacorb.notification.engine.DefaultTaskProcessor
All Implemented Interfaces:
org.picocontainer.Disposable, Disposable, TaskProcessor

public class DefaultTaskProcessor
extends java.lang.Object
implements TaskProcessor, Disposable

Version:
$Id: DefaultTaskProcessor.java,v 1.10 2005/05/01 21:10:09 alphonse.bendt Exp $
Author:
Alphonse Bendt

Constructor Summary
DefaultTaskProcessor(org.apache.avalon.framework.configuration.Configuration config)
          Start ClockDaemon Set up TaskExecutors Set up TaskFactory
 
Method Summary
 void cancelTask(java.lang.Object id)
           
 void dispose()
          shutdown this TaskProcessor.
 java.lang.Object executeTaskAfterDelay(long delay, java.lang.Runnable task)
           
 java.lang.Object executeTaskPeriodically(long intervall, java.lang.Runnable task, boolean startImmediately)
           
 TaskExecutor getFilterTaskExecutor()
           
 TaskFactory getTaskFactory()
           
 void processMessage(Message mesg)
          process a Message. the various settings for the Message (timeout, starttime, stoptime) are checked and applied.
protected  void processMessageInternal(Message event)
          process a Message. create FilterTask and schedule it.
 void schedulePushOperation(IProxyPushSupplier pushSupplier)
          Schedule MessageConsumer for a deliver-Operation.
 void scheduleTimedPullTask(MessageSupplier messageSupplier)
          Schedule ProxyPullConsumer for pull-Operation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultTaskProcessor

public DefaultTaskProcessor(org.apache.avalon.framework.configuration.Configuration config)
Start ClockDaemon Set up TaskExecutors Set up TaskFactory

Method Detail

getTaskFactory

public TaskFactory getTaskFactory()
Specified by:
getTaskFactory in interface TaskProcessor

getFilterTaskExecutor

public TaskExecutor getFilterTaskExecutor()
Specified by:
getFilterTaskExecutor in interface TaskProcessor

dispose

public void dispose()
shutdown this TaskProcessor. The TaskExecutors will be shutdown, the running Threads interrupted and all allocated ressources will be freed. As the active Threads will be interrupted pending Events will be discarded.

Specified by:
dispose in interface org.picocontainer.Disposable

processMessage

public void processMessage(Message mesg)
process a Message. the various settings for the Message (timeout, starttime, stoptime) are checked and applied.

Specified by:
processMessage in interface TaskProcessor

processMessageInternal

protected void processMessageInternal(Message event)
process a Message. create FilterTask and schedule it.


scheduleTimedPullTask

public void scheduleTimedPullTask(MessageSupplier messageSupplier)
                           throws java.lang.InterruptedException
Schedule ProxyPullConsumer for pull-Operation. If a Supplier connects to a ProxyPullConsumer the ProxyPullConsumer needs to regularely poll the Supplier. This method queues a Task to run runPullEvent on the specified TimerEventSupplier

Specified by:
scheduleTimedPullTask in interface TaskProcessor
Throws:
java.lang.InterruptedException

schedulePushOperation

public void schedulePushOperation(IProxyPushSupplier pushSupplier)
                           throws java.lang.InterruptedException
Schedule MessageConsumer for a deliver-Operation. Some MessageConsumers (namely SequenceProxyPushSuppliers) need to push Messages regularely to its connected Consumer. Schedule a Task to call deliverPendingEvents on the specified MessageConsumer. Also used after a disabled MessageConsumer is enabled again to push the pending Messages.

Specified by:
schedulePushOperation in interface TaskProcessor
Throws:
java.lang.InterruptedException

executeTaskPeriodically

public java.lang.Object executeTaskPeriodically(long intervall,
                                                java.lang.Runnable task,
                                                boolean startImmediately)
Specified by:
executeTaskPeriodically in interface TaskProcessor

cancelTask

public void cancelTask(java.lang.Object id)
Specified by:
cancelTask in interface TaskProcessor

executeTaskAfterDelay

public java.lang.Object executeTaskAfterDelay(long delay,
                                              java.lang.Runnable task)
Specified by:
executeTaskAfterDelay in interface TaskProcessor