com.caucho.server.util
Class ScheduledThreadPool

java.lang.Object
  extended by com.caucho.server.util.ScheduledThreadPool
All Implemented Interfaces:
EnvironmentListener, java.io.Serializable, java.util.concurrent.Executor, java.util.concurrent.ExecutorService, java.util.concurrent.ScheduledExecutorService

public class ScheduledThreadPool
extends java.lang.Object
implements java.util.concurrent.ScheduledExecutorService, EnvironmentListener, java.io.Serializable

Scheduler for custom services.

See Also:
Serialized Form

Method Summary
 boolean awaitTermination(long timeout, java.util.concurrent.TimeUnit unit)
          Blocks until the tasks complete.
 void environmentBind(EnvironmentClassLoader loader)
          Called when the environment bind phase
 void environmentConfigure(EnvironmentClassLoader loader)
          Called when the environment config phase
 void environmentStart(EnvironmentClassLoader loader)
          Called when the environment starts.
 void environmentStop(EnvironmentClassLoader loader)
          Called when the environment stops.
 void execute(java.lang.Runnable command)
          Launches a thread to execute a command.
static ScheduledThreadPool getLocal()
           
 java.util.Timer getTimer()
          Returns the Timer for this pool.
 java.util.List invokeAll(java.util.Collection tasks)
          Invokes a set of tasks.
 java.util.List invokeAll(java.util.Collection tasks, long timeout, java.util.concurrent.TimeUnit unit)
          Invokes a set of tasks.
 java.lang.Object invokeAny(java.util.Collection tasks)
          Invokes a set of tasks.
 java.lang.Object invokeAny(java.util.Collection tasks, long timeout, java.util.concurrent.TimeUnit unit)
          Invokes a set of tasks.
 boolean isShutdown()
          Return true if the executor is shut down.
 boolean isTerminated()
          Return true if the executor has completed shutting down.
<V> java.util.concurrent.ScheduledFuture<V>
schedule(java.util.concurrent.Callable<V> callable, long delay, java.util.concurrent.TimeUnit unit)
          Schedules a future task.
 java.util.concurrent.ScheduledFuture<?> schedule(java.lang.Runnable command, long delay, java.util.concurrent.TimeUnit unit)
          Schedules a future task.
 java.util.concurrent.ScheduledFuture<?> scheduleAtFixedRate(java.lang.Runnable command, long initialDelay, long period, java.util.concurrent.TimeUnit unit)
          Schedules a future task.
 java.util.concurrent.ScheduledFuture<?> scheduleWithFixedDelay(java.lang.Runnable command, long initialDelay, long delay, java.util.concurrent.TimeUnit unit)
          Schedules with fixed delay
 void shutdown()
          Starts the shutdown.
 java.util.List<java.lang.Runnable> shutdownNow()
          Starts the shutdown.
<T> java.util.concurrent.Future<T>
submit(java.util.concurrent.Callable<T> task)
          Submits a task for execution.
 java.util.concurrent.Future<?> submit(java.lang.Runnable command)
          Submits a task for execution.
<T> java.util.concurrent.Future<T>
submit(java.lang.Runnable task, T result)
          Submits a task for execution.
 java.lang.String toString()
           
 java.lang.Object writeReplace()
          Serialize to a webbeans handle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Method Detail

getLocal

public static ScheduledThreadPool getLocal()

execute

public void execute(java.lang.Runnable command)
Launches a thread to execute a command.

Specified by:
execute in interface java.util.concurrent.Executor

awaitTermination

public boolean awaitTermination(long timeout,
                                java.util.concurrent.TimeUnit unit)
Blocks until the tasks complete.

Specified by:
awaitTermination in interface java.util.concurrent.ExecutorService

invokeAll

public java.util.List invokeAll(java.util.Collection tasks)
Invokes a set of tasks.

Specified by:
invokeAll in interface java.util.concurrent.ExecutorService

invokeAll

public java.util.List invokeAll(java.util.Collection tasks,
                                long timeout,
                                java.util.concurrent.TimeUnit unit)
Invokes a set of tasks.

Specified by:
invokeAll in interface java.util.concurrent.ExecutorService

invokeAny

public java.lang.Object invokeAny(java.util.Collection tasks)
Invokes a set of tasks.

Specified by:
invokeAny in interface java.util.concurrent.ExecutorService

invokeAny

public java.lang.Object invokeAny(java.util.Collection tasks,
                                  long timeout,
                                  java.util.concurrent.TimeUnit unit)
Invokes a set of tasks.

Specified by:
invokeAny in interface java.util.concurrent.ExecutorService

isShutdown

public boolean isShutdown()
Return true if the executor is shut down.

Specified by:
isShutdown in interface java.util.concurrent.ExecutorService

isTerminated

public boolean isTerminated()
Return true if the executor has completed shutting down.

Specified by:
isTerminated in interface java.util.concurrent.ExecutorService

shutdown

public void shutdown()
Starts the shutdown.

Specified by:
shutdown in interface java.util.concurrent.ExecutorService

shutdownNow

public java.util.List<java.lang.Runnable> shutdownNow()
Starts the shutdown.

Specified by:
shutdownNow in interface java.util.concurrent.ExecutorService

submit

public <T> java.util.concurrent.Future<T> submit(java.util.concurrent.Callable<T> task)
Submits a task for execution.

Specified by:
submit in interface java.util.concurrent.ExecutorService

submit

public java.util.concurrent.Future<?> submit(java.lang.Runnable command)
Submits a task for execution.

Specified by:
submit in interface java.util.concurrent.ExecutorService

submit

public <T> java.util.concurrent.Future<T> submit(java.lang.Runnable task,
                                                 T result)
Submits a task for execution.

Specified by:
submit in interface java.util.concurrent.ExecutorService

schedule

public <V> java.util.concurrent.ScheduledFuture<V> schedule(java.util.concurrent.Callable<V> callable,
                                                            long delay,
                                                            java.util.concurrent.TimeUnit unit)
Schedules a future task.

Specified by:
schedule in interface java.util.concurrent.ScheduledExecutorService

schedule

public java.util.concurrent.ScheduledFuture<?> schedule(java.lang.Runnable command,
                                                        long delay,
                                                        java.util.concurrent.TimeUnit unit)
Schedules a future task.

Specified by:
schedule in interface java.util.concurrent.ScheduledExecutorService

scheduleAtFixedRate

public java.util.concurrent.ScheduledFuture<?> scheduleAtFixedRate(java.lang.Runnable command,
                                                                   long initialDelay,
                                                                   long period,
                                                                   java.util.concurrent.TimeUnit unit)
Schedules a future task.

Specified by:
scheduleAtFixedRate in interface java.util.concurrent.ScheduledExecutorService

scheduleWithFixedDelay

public java.util.concurrent.ScheduledFuture<?> scheduleWithFixedDelay(java.lang.Runnable command,
                                                                      long initialDelay,
                                                                      long delay,
                                                                      java.util.concurrent.TimeUnit unit)
Schedules with fixed delay

Specified by:
scheduleWithFixedDelay in interface java.util.concurrent.ScheduledExecutorService

getTimer

public java.util.Timer getTimer()
Returns the Timer for this pool.


environmentConfigure

public void environmentConfigure(EnvironmentClassLoader loader)
Called when the environment config phase

Specified by:
environmentConfigure in interface EnvironmentListener

environmentBind

public void environmentBind(EnvironmentClassLoader loader)
Called when the environment bind phase

Specified by:
environmentBind in interface EnvironmentListener

environmentStart

public void environmentStart(EnvironmentClassLoader loader)
Called when the environment starts.

Specified by:
environmentStart in interface EnvironmentListener

environmentStop

public void environmentStop(EnvironmentClassLoader loader)
Called when the environment stops.

Specified by:
environmentStop in interface EnvironmentListener

writeReplace

public java.lang.Object writeReplace()
Serialize to a webbeans handle


toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object