net.sf.asyncobjects.util.timer
Interface ATimer

All Superinterfaces:
ACloseable, AsyncObject
All Known Implementing Classes:
TimerWrapper

public interface ATimer
extends ACloseable

Timer interface. It closely mimics Timer class. The ACloseable.close() works like Timer.cancel().

Author:
const

Method Summary
 Promise<Integer> purge()
          Remove all tasks from the timer
 Promise<ACallable<Boolean>> schedule(Date time, ATimerTask task)
          Schedule task at specified time
 Promise<ACallable<Boolean>> schedule(Date firstTime, long period, ATimerTask task)
          Schedule task after specfied time with specified period
 Promise<ACallable<Boolean>> schedule(long delay, ATimerTask task)
          Schedule task after specified delay
 Promise<ACallable<Boolean>> schedule(long delay, long period, ATimerTask task)
          Schedule task after specfied delay with specified period
 Promise<ACallable<Boolean>> scheduleAtFixedRate(Date firstTime, long period, ATimerTask task)
          Schedule task after specfied time with fixed rage
 Promise<ACallable<Boolean>> scheduleAtFixedRate(long delay, long period, ATimerTask task)
          Schedule task after specfied delay with fixed rate
 
Methods inherited from interface net.sf.asyncobjects.ACloseable
close
 
Methods inherited from interface net.sf.asyncobjects.AsyncObject
dereference, isImmediate
 

Method Detail

purge

Promise<Integer> purge()
Remove all tasks from the timer

Returns:
amount of purged tasks

schedule

Promise<ACallable<Boolean>> schedule(long delay,
                                     ATimerTask task)
Schedule task after specified delay

Parameters:
delay - a delay
task - a taks to schedule.
Returns:
a promise for cancel action
See Also:
Timer.schedule(java.util.TimerTask, long), TimerTask.cancel()

schedule

Promise<ACallable<Boolean>> schedule(Date time,
                                     ATimerTask task)
Schedule task at specified time

Parameters:
time - a time to schedule at
task - a taks to schedule.
Returns:
a promise for cancel action
See Also:
Timer.schedule(java.util.TimerTask, Date), TimerTask.cancel()

schedule

Promise<ACallable<Boolean>> schedule(long delay,
                                     long period,
                                     ATimerTask task)
Schedule task after specfied delay with specified period

Parameters:
delay - a delay
period - a period
task - a taks to schedule.
Returns:
a promise for cancel action
See Also:
Timer.schedule(java.util.TimerTask, long, long), TimerTask.cancel()

schedule

Promise<ACallable<Boolean>> schedule(Date firstTime,
                                     long period,
                                     ATimerTask task)
Schedule task after specfied time with specified period

Parameters:
firstTime - a first time the task is executed
period - a period
task - a taks to schedule.
Returns:
a promise for cancel action
See Also:
Timer.schedule(java.util.TimerTask, long, long), TimerTask.cancel()

scheduleAtFixedRate

Promise<ACallable<Boolean>> scheduleAtFixedRate(long delay,
                                                long period,
                                                ATimerTask task)
Schedule task after specfied delay with fixed rate

Parameters:
delay - a delay
period - a period
task - a taks to schedule.
Returns:
a promise for cancel action
See Also:
Timer.schedule(java.util.TimerTask, long, long), TimerTask.cancel()

scheduleAtFixedRate

Promise<ACallable<Boolean>> scheduleAtFixedRate(Date firstTime,
                                                long period,
                                                ATimerTask task)
Schedule task after specfied time with fixed rage

Parameters:
firstTime - a first time the task is executed
period - a period
task - a taks to schedule.
Returns:
a promise for cancel action
See Also:
Timer.schedule(java.util.TimerTask, long, long), TimerTask.cancel()


Copyright 2002-2007 Constantine Plotnikov. All Rights Reserved.