org.apache.cocoon.thread
Interface RunnableManager


public interface RunnableManager

The RunnableManager interface describes the functionality of an implementation running commands in the background.

Version:
$Id: RunnableManager.html 1304280 2012-03-23 11:18:01Z ilgrosso $

Field Summary
static String ROLE
          The role name
 
Method Summary
 ThreadPool createPool(int queueSize, int maxPoolSize, int minPoolSize, int priority, boolean isDaemon, long keepAliveTime, String blockPolicy, boolean shutdownGraceful, int shutdownWaitTime)
          Create a private ThreadPool with a specific ThreadFactory
 ThreadPool createPool(String name, int queueSize, int maxPoolSize, int minPoolSize, int priority, boolean isDaemon, long keepAliveTime, String blockPolicy, boolean shutdownGraceful, int shutdownWaitTime)
          Create a shared ThreadPool with a specific ThreadFactory
 void execute(Runnable command)
          Immediate Execution of a runnable in the background
 void execute(Runnable command, long delay)
          Immediate Execution of a runnable in the background
 void execute(Runnable command, long delay, long interval)
          Immediate Execution of a runnable in the background
 void execute(String threadPoolName, Runnable command)
          Immediate Execution of a runnable in the background
 void execute(String threadPoolName, Runnable command, long delay)
          Immediate Execution of a runnable in the background
 void execute(String threadPoolName, Runnable command, long delay, long interval)
          Delayed and repeated Execution of a runnable in the background
 ThreadPool getPool(String name)
          Get a thread pool
 void remove(Runnable command)
          Remove a Runnable from the execution stack
 

Field Detail

ROLE

public static final String ROLE
The role name

Method Detail

createPool

public ThreadPool createPool(String name,
                             int queueSize,
                             int maxPoolSize,
                             int minPoolSize,
                             int priority,
                             boolean isDaemon,
                             long keepAliveTime,
                             String blockPolicy,
                             boolean shutdownGraceful,
                             int shutdownWaitTime)
Create a shared ThreadPool with a specific ThreadFactory

Parameters:
name - The name of the thread pool
queueSize - The size of the queue
maxPoolSize - The maximum number of threads
minPoolSize - The maximum number of threads
priority - The priority of threads created by this pool. This is one of Thread.MIN_PRIORITY, Thread.NORM_PRIORITY, or Thread.MAX_PRIORITY
isDaemon - Whether or not thread from the pool should run in daemon mode
keepAliveTime - How long should a thread be alive for new work to be done before it is GCed
blockPolicy - What's the blocking policy is resources are exhausted
shutdownGraceful - Should we wait for the queue to finish all pending commands?
shutdownWaitTime - After what time a normal shutdown should take into account if a graceful shutdown has not come to an end

createPool

public ThreadPool createPool(int queueSize,
                             int maxPoolSize,
                             int minPoolSize,
                             int priority,
                             boolean isDaemon,
                             long keepAliveTime,
                             String blockPolicy,
                             boolean shutdownGraceful,
                             int shutdownWaitTime)
Create a private ThreadPool with a specific ThreadFactory

Parameters:
queueSize - The size of the queue
maxPoolSize - The maximum number of threads
minPoolSize - The maximum number of threads
priority - The priority of threads created by this pool. This is one of Thread.MIN_PRIORITY, Thread.NORM_PRIORITY, or Thread.MAX_PRIORITY
isDaemon - Whether or not thread from the pool should run in daemon mode
keepAliveTime - How long should a thread be alive for new work to be done before it is GCed
blockPolicy - What's the blocking policy is resources are exhausted
shutdownGraceful - Should we wait for the queue to finish all pending commands?
shutdownWaitTime - After what time a normal shutdown should take into account if a graceful shutdown has not come to an end
Returns:
The newly created ThreadPool

getPool

public ThreadPool getPool(String name)
Get a thread pool

Parameters:
name - The name of the thread pool or null for the default pool.

execute

public void execute(Runnable command)
Immediate Execution of a runnable in the background

Parameters:
command - The command to execute

execute

public void execute(Runnable command,
                    long delay)
Immediate Execution of a runnable in the background

Parameters:
command - The command to execute
delay - The delay before first run

execute

public void execute(Runnable command,
                    long delay,
                    long interval)
Immediate Execution of a runnable in the background

Parameters:
command - The command to execute
delay - The delay before first run
interval - The interval of repeated runs

execute

public void execute(String threadPoolName,
                    Runnable command)
Immediate Execution of a runnable in the background

Parameters:
threadPoolName - The thread pool to use
command - The command to execute

execute

public void execute(String threadPoolName,
                    Runnable command,
                    long delay)
Immediate Execution of a runnable in the background

Parameters:
threadPoolName - The thread pool to use
command - The command to execute
delay - The delay before first run

execute

public void execute(String threadPoolName,
                    Runnable command,
                    long delay,
                    long interval)
Delayed and repeated Execution of a runnable in the background

Parameters:
threadPoolName - The thread pool to use
command - The command to execute
delay - The delay before first run
interval - The interval of repeated runs

remove

public void remove(Runnable command)
Remove a Runnable from the execution stack

Parameters:
command - The command to be removed


Copyright 1999-2008 The Apache Software Foundation. All Rights Reserved.