Errai 3.0.1-SNAPSHOT

org.jboss.errai.bus.server.async.scheduling
Class PooledExecutorService

java.lang.Object
  extended by org.jboss.errai.bus.server.async.scheduling.PooledExecutorService
All Implemented Interfaces:
TaskProvider

public class PooledExecutorService
extends Object
implements TaskProvider


Nested Class Summary
static class PooledExecutorService.SaturationPolicy
          Enumeration of possible ways of handling a queue full scenario.
 
Constructor Summary
PooledExecutorService(int queueSize)
          Constructs a new PooledExecutorService with the specified queue size.
PooledExecutorService(int queueSize, PooledExecutorService.SaturationPolicy saturationPolicy)
           
 
Method Summary
 void execute(Runnable runnable)
          Schedule a task for immediate execution.
 TimedTask getNextTask()
          Returns the next Runnable task that is currently due to run.
 void requestStop()
           
 AsyncTask schedule(Runnable runnable, TimeUnit unit, long interval)
           
 AsyncTask scheduleRepeating(Runnable runnable, TimeUnit unit, long initial, long interval)
           
 void shutdown()
           
 void start()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PooledExecutorService

public PooledExecutorService(int queueSize)
Constructs a new PooledExecutorService with the specified queue size.

Parameters:
queueSize - The size of the underlying worker queue.

PooledExecutorService

public PooledExecutorService(int queueSize,
                             PooledExecutorService.SaturationPolicy saturationPolicy)
Method Detail

execute

public void execute(Runnable runnable)
             throws InterruptedException
Schedule a task for immediate execution.

Parameters:
runnable - Runnable task
Throws:
InterruptedException - thrown if the thread waiting for an empty spot on the execution queue is interrupted.

schedule

public AsyncTask schedule(Runnable runnable,
                          TimeUnit unit,
                          long interval)

scheduleRepeating

public AsyncTask scheduleRepeating(Runnable runnable,
                                   TimeUnit unit,
                                   long initial,
                                   long interval)

start

public void start()

shutdown

public void shutdown()

getNextTask

public TimedTask getNextTask()
                      throws InterruptedException
Returns the next Runnable task that is currently due to run. This method will block until a task is available.

Specified by:
getNextTask in interface TaskProvider
Returns:
Runnable task.
Throws:
InterruptedException - thrown if the thread waiting on a ready task is interrupted.

requestStop

public void requestStop()

Errai 3.0.1-SNAPSHOT

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