com.sun.sgs.impl.kernel.schedule
Class TimedTaskHandler

java.lang.Object
  extended by com.sun.sgs.impl.kernel.schedule.TimedTaskHandler

 class TimedTaskHandler
extends Object

Package-private utility class that handles timers for tasks that are scheduled to run in the future.


Field Summary
(package private) static int FUTURE_THRESHOLD
          The milliseconds in the future that a task must be to be accepted by the handler.
 
Constructor Summary
TimedTaskHandler(TimedTaskListener listener)
          Creates an instance of TimedTaskHandler.
 
Method Summary
(package private)  boolean runDelayed(ScheduledTask task)
          Tries to pass off a task to be run at some point in the future.
(package private)  void shutdown()
          Shuts down this handler, cancelling the associated timer.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

FUTURE_THRESHOLD

static final int FUTURE_THRESHOLD
The milliseconds in the future that a task must be to be accepted by the handler.

See Also:
Constant Field Values
Constructor Detail

TimedTaskHandler

TimedTaskHandler(TimedTaskListener listener)
Creates an instance of TimedTaskHandler. This has the effect of creating a new Timer which involves creating at least one new thread.

Parameters:
listener - the TimedTaskListener that will consume the task when its time comes, causing it to be executed
Method Detail

runDelayed

boolean runDelayed(ScheduledTask task)
Tries to pass off a task to be run at some point in the future. If the task should be run directly instead of delayed, then it is rejected and the method returns false.

Parameters:
task - the ScheduledTask to run in the future
Returns:
true if the task is accepted to run delayed, false otherwise

shutdown

void shutdown()
Shuts down this handler, cancelling the associated timer.


RedDwarf, Version 0.10.1
2010-03-14 10:56:12

Copyright © 2010 The RedDwarf Authors. All rights reserved
Copyright © 2007-2010 Sun Microsystems, Inc. All rights reserved