org.jacorb.notification.engine
Class TaskProcessor

java.lang.Object
  extended by org.jacorb.notification.engine.TaskProcessor
All Implemented Interfaces:
org.apache.avalon.framework.configuration.Configurable, Disposable

public class TaskProcessor
extends java.lang.Object
implements Disposable, org.apache.avalon.framework.configuration.Configurable

Version:
$Id: TaskProcessor.java,v 1.21 2004/05/06 12:39:59 nicolas Exp $
Author:
Alphonse Bendt

Constructor Summary
TaskProcessor()
          Start ClockDaemon Set up TaskExecutors Set up TaskFactory
 
Method Summary
 void cancelTask(java.lang.Object id)
           
 void configure(org.apache.avalon.framework.configuration.Configuration conf)
           
 void configureTaskExecutor(AbstractProxySupplier proxySupplier)
          configure a AbstractProxySupplier to use a TaskExecutor dependent on the settings for the current Channel.
 void dispose()
          shutdown this TaskProcessor.
 java.lang.Object executeTaskPeriodically(long intervall, java.lang.Runnable task, boolean startImmediately)
           
 long getBackoutInterval()
           
 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 scheduleTimedPullTask(MessageSupplier dest)
          Schedule ProxyPullConsumer for pull-Operation.
 void scheduleTimedPushTask(MessageConsumer consumer)
          Schedule MessageConsumer for a deliver-Operation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TaskProcessor

public TaskProcessor()
Start ClockDaemon Set up TaskExecutors Set up TaskFactory

Method Detail

configure

public void configure(org.apache.avalon.framework.configuration.Configuration conf)
Specified by:
configure in interface org.apache.avalon.framework.configuration.Configurable

getTaskFactory

public TaskFactory getTaskFactory()

getBackoutInterval

public long getBackoutInterval()

configureTaskExecutor

public void configureTaskExecutor(AbstractProxySupplier proxySupplier)
configure a AbstractProxySupplier to use a TaskExecutor dependent on the settings for the current Channel.


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 Disposable

processMessage

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


processMessageInternal

protected void processMessageInternal(Message event)
process a Message. create FilterTask and schedule it. visibility is protected so that method is accessible in test code.


scheduleTimedPullTask

public void scheduleTimedPullTask(MessageSupplier dest)
                           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

Throws:
java.lang.InterruptedException

scheduleTimedPushTask

public void scheduleTimedPushTask(MessageConsumer consumer)
                           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.

Throws:
java.lang.InterruptedException

executeTaskPeriodically

public java.lang.Object executeTaskPeriodically(long intervall,
                                                java.lang.Runnable task,
                                                boolean startImmediately)

cancelTask

public void cancelTask(java.lang.Object id)