org.apache.cocoon.components.thread
Interface RunnableManager

All Known Implementing Classes:
DefaultRunnableManager

public interface RunnableManager

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

Version:
CVS $Id: RunnableManager.html 1304258 2012-03-23 10:09:27Z ilgrosso $
Author:
Giacomo Pati

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
 void 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
 void remove(Runnable command)
          Remove a Runnable from the execution stack
 

Field Detail

ROLE

static final String ROLE
The role name

Method Detail

createPool

void 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

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

execute

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

Parameters:
command - The command to execute

execute

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

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

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

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

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

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

Parameters:
command - The command to be removed


Copyright © 1999-2010 The Apache Software Foundation. All Rights Reserved.