org.jacorb.notification.engine
Class AbstractTask

java.lang.Object
  extended byorg.jacorb.notification.util.AbstractPoolable
      extended byorg.jacorb.notification.engine.AbstractTask
All Implemented Interfaces:
org.picocontainer.Disposable, Disposable, java.lang.Runnable, Schedulable
Direct Known Subclasses:
AbstractMessageTask, PullFromSupplierTask

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

Version:
$Id: AbstractTask.java,v 1.15 2005/04/27 10:48:40 alphonse.bendt Exp $
Author:
Alphonse Bendt

Field Summary
 
Fields inherited from class org.jacorb.notification.util.AbstractPoolable
logger_
 
Constructor Summary
AbstractTask()
           
 
Method Summary
protected  void checkInterrupt()
           
abstract  void doWork()
          Override this Method in Subclasses to do the "real work".
protected  TaskExecutor getTaskExecutor()
           
protected  boolean isRunnable()
           
 void run()
          template method.
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.
protected  void setTaskExecutor(TaskExecutor taskExecutor)
           
 
Methods inherited from class org.jacorb.notification.util.AbstractPoolable
dispose, reset, setObjectPool
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.jacorb.notification.engine.Schedulable
schedule
 

Constructor Detail

AbstractTask

public AbstractTask()
Method Detail

getTaskExecutor

protected TaskExecutor getTaskExecutor()

setTaskExecutor

protected void setTaskExecutor(TaskExecutor taskExecutor)

doWork

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

Throws:
java.lang.Exception

isRunnable

protected boolean isRunnable()

run

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

Specified by:
run in interface java.lang.Runnable

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:
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:
InterruptedException - if an error occurs