org.jacorb.notification.engine
Class AbstractTask

java.lang.Object
  extended by org.jacorb.notification.interfaces.AbstractPoolable
      extended by org.jacorb.notification.engine.AbstractTask
All Implemented Interfaces:
java.lang.Runnable, org.apache.avalon.framework.configuration.Configurable, Disposable
Direct Known Subclasses:
AbstractDeliverTask, FilterConsumerAdminTask, FilterProxyConsumerTask, FilterProxySupplierTask, FilterSupplierAdminTask, PullFromSupplierTask

public abstract class AbstractTask
extends AbstractPoolable
implements java.lang.Runnable

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

Field Summary
protected  Message message_
           
 
Fields inherited from class org.jacorb.notification.interfaces.AbstractPoolable
logger_
 
Constructor Summary
protected AbstractTask(TaskProcessor tp)
           
 
Method Summary
protected  void checkInterrupt()
           
 Message copyMessage()
           
abstract  void doWork()
          Override this Method in Subclasses to do the "real work".
protected  TaskExecutor getTaskExecutor()
           
protected  TaskProcessor getTaskProcessor()
           
 Message removeMessage()
           
 void reset()
          Reset the Object to an initial state.
 void run()
          template method.
abstract  void schedule()
           
protected  void schedule(boolean directRunAllowed)
          Run this Task on its configured Executor.
protected  void schedule(TaskExecutor executor, boolean directRunAllowed)
          Run this Task on the provided Executor.
 void setMessage(Message event)
          set the Message for this Task to use.
protected  void setTaskExecutor(TaskExecutor taskExecutor)
           
 
Methods inherited from class org.jacorb.notification.interfaces.AbstractPoolable
configure, dispose, setObjectPool
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

message_

protected Message message_
Constructor Detail

AbstractTask

protected AbstractTask(TaskProcessor tp)
Method Detail

getTaskExecutor

protected TaskExecutor getTaskExecutor()

setTaskExecutor

protected void setTaskExecutor(TaskExecutor taskExecutor)

getTaskProcessor

protected TaskProcessor getTaskProcessor()

setMessage

public void setMessage(Message event)
set the Message for this Task to use.


removeMessage

public Message removeMessage()

copyMessage

public Message copyMessage()

doWork

public abstract void doWork()
                     throws java.lang.Exception
Override this Method in Subclasses to do the "real work".

Throws:
java.lang.Exception

run

public void run()
template method.
  1. Call doWork()

Specified by:
run in interface java.lang.Runnable

reset

public void reset()
Description copied from class: AbstractPoolable
Reset the Object to an initial state. Subclasses should override this method appropiately to reset the instance to an initial state.

Specified by:
reset in class AbstractPoolable

checkInterrupt

protected void checkInterrupt()
                       throws java.lang.InterruptedException
Throws:
java.lang.InterruptedException

schedule

protected void schedule(boolean directRunAllowed)
                 throws java.lang.InterruptedException
Run this Task on its configured Executor.

Parameters:
directRunAllowed - this param specified if its allowed to run this Task on the calling Thread.
Throws:
java.lang.InterruptedException - if an error occurs

schedule

protected void schedule(TaskExecutor executor,
                        boolean directRunAllowed)
                 throws java.lang.InterruptedException
Run this Task on the provided Executor.

Parameters:
executor - a TaskExecutor value
directRunAllowed - a boolean value
Throws:
java.lang.InterruptedException - if an error occurs

schedule

public abstract void schedule()
                       throws java.lang.InterruptedException
Throws:
java.lang.InterruptedException