net.sf.asyncobjects.util.timer
Class TimerTaskAdapter

java.lang.Object
  extended by net.sf.asyncobjects.util.timer.TimerTaskAdapter
All Implemented Interfaces:
ExplicitSharing

public abstract class TimerTaskAdapter
extends Object
implements ExplicitSharing

An adapter that helps to impelemnt time tasks.

Author:
const

Nested Class Summary
 class TimerTaskAdapter.InternalTimerTask
          Internal class that acutally implemetns interface
 
Constructor Summary
TimerTaskAdapter()
           
 
Method Summary
 Promise<Boolean> cancel()
          Cancel task.
 ATimerTask export()
           
protected abstract  void run(long scheduledExecutionTime)
          Run the task.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TimerTaskAdapter

public TimerTaskAdapter()
Method Detail

cancel

public Promise<Boolean> cancel()
Cancel task. Note that promise might never resolves ans the task is not accpeted by the timer. So do not rely on in in the application logic.

Returns:
true if some further execution of the task were prevented

run

protected abstract void run(long scheduledExecutionTime)
                     throws Throwable
Run the task. The method is indirectly dispatched from TimerTask.run(). Note that it is exectuted in the vat where this object has been created rather than in timer's thread.

Parameters:
scheduledExecutionTime - a time when the task was scheduled. it might be used to check if the task is too late. The value provided by the TimerTask.scheduledExecutionTime() is used.
Throws:
Throwable - if there is a problem

export

public ATimerTask export()
Returns:
an asynchronous facet


Copyright © 2002-2007 Constantine Plotnikov. All Rights Reserved.