Errai 3.0.1-SNAPSHOT

org.jboss.errai.bus.server
Class DefaultTaskManager

java.lang.Object
  extended by org.jboss.errai.bus.server.DefaultTaskManager
All Implemented Interfaces:
TaskManager

public class DefaultTaskManager
extends Object
implements TaskManager


Method Summary
 void execute(Runnable task)
          Schedules the given task for immediate execution, either on the calling thread or on the first available worker thread.
static DefaultTaskManager get()
           
 void requestStop()
          Prevents this task manager from beginning execution of all pending tasks.
 AsyncTask schedule(TimeUnit unit, int interval, Runnable task)
          Schedules the given task for execution at a later time.
 AsyncTask scheduleRepeating(TimeUnit unit, int interval, Runnable task)
          Schedules the given task for repeated execution at the given rate.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

get

public static DefaultTaskManager get()

execute

public void execute(Runnable task)
Description copied from interface: TaskManager
Schedules the given task for immediate execution, either on the calling thread or on the first available worker thread.

Specified by:
execute in interface TaskManager
Parameters:
task - The task to execute.

scheduleRepeating

public AsyncTask scheduleRepeating(TimeUnit unit,
                                   int interval,
                                   Runnable task)
Description copied from interface: TaskManager
Schedules the given task for repeated execution at the given rate.

Efforts are made to ensure repeating tasks begin execution at fixed time intervals, rather than having a fixed delay between the end of execution and the beginning of the next. For example, when a task that takes about 2 seconds to run is scheduled for repeating execution every 10 seconds, it will begin execution every 10 seconds. There will be about 8 seconds between the end of one execution and the beginning of the next. However, if a task that takes 20 seconds is scheduled to run every 10 seconds, it will not be re-executed while it is still running. In this case (where a task takes longer to execute than the specified interval), the task will be rescheduled for immediate execution upon completion.

Specified by:
scheduleRepeating in interface TaskManager
Parameters:
unit - Specifies the units that interval is interpreted in.
interval - Amount of time to wait before starting each successive execution.
task - The task to execute repeatedly.
Returns:
A handle on the repeating task that allows it to be canceled.

schedule

public AsyncTask schedule(TimeUnit unit,
                          int interval,
                          Runnable task)
Description copied from interface: TaskManager
Schedules the given task for execution at a later time.

Specified by:
schedule in interface TaskManager
Parameters:
unit - Specifies the units that interval is interpreted in.
interval - Amount of time to wait before starting each successive execution.
task - The task to execute repeatedly.
Returns:
A handle on the repeating task that allows it to be canceled.

requestStop

public void requestStop()
Description copied from interface: TaskManager
Prevents this task manager from beginning execution of all pending tasks. Does not terminate tasks that are currently executing.

Once this method has been called, any further method calls on this TaskManager will result in an IllegalStateException.

Specified by:
requestStop in interface TaskManager

Errai 3.0.1-SNAPSHOT

Copyright © 2013-2014 JBoss, a division of Red Hat. All Rights Reserved.