org.apache.activemq.thread
Class TaskRunnerFactory

java.lang.Object
  extended by org.apache.activemq.thread.TaskRunnerFactory
All Implemented Interfaces:
Executor

public class TaskRunnerFactory
extends Object
implements Executor

Manages the thread pool for long running tasks. Long running tasks are not always active but when they are active, they may need a few iterations of processing for them to become idle. The manager ensures that each task is processes but that no one task overtakes the system. This is kinda like cooperative multitasking.


Constructor Summary
TaskRunnerFactory()
           
TaskRunnerFactory(String name)
           
TaskRunnerFactory(String name, int priority, boolean daemon, int maxIterationsPerRun, boolean dedicatedTaskRunner)
           
TaskRunnerFactory(String name, int priority, boolean daemon, int maxIterationsPerRun, boolean dedicatedTaskRunner, int maxThreadPoolSize)
           
 
Method Summary
protected  ExecutorService createDefaultExecutor()
           
 TaskRunner createTaskRunner(Task task, String name)
           
 void execute(Runnable runnable)
           
 void execute(Runnable runnable, String name)
           
 ExecutorService getExecutor()
           
 int getMaxIterationsPerRun()
           
 int getMaxThreadPoolSize()
           
 String getName()
           
 int getPriority()
           
 RejectedExecutionHandler getRejectedTaskHandler()
           
 long getShutdownAwaitTermination()
           
 void init()
           
 boolean isDaemon()
           
 boolean isDedicatedTaskRunner()
           
 void setDaemon(boolean daemon)
           
 void setDedicatedTaskRunner(boolean dedicatedTaskRunner)
           
 void setExecutor(ExecutorService executor)
           
 void setMaxIterationsPerRun(int maxIterationsPerRun)
           
 void setMaxThreadPoolSize(int maxThreadPoolSize)
           
 void setName(String name)
           
 void setPriority(int priority)
           
 void setRejectedTaskHandler(RejectedExecutionHandler rejectedTaskHandler)
           
 void setShutdownAwaitTermination(long shutdownAwaitTermination)
           
 void shutdown()
          Performs a shutdown only, by which the thread pool is shutdown by not graceful nor aggressively.
 void shutdownGraceful()
          Performs a graceful shutdown.
 void shutdownNow()
          Performs a shutdown now (aggressively) on the thread pool.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TaskRunnerFactory

public TaskRunnerFactory()

TaskRunnerFactory

public TaskRunnerFactory(String name)

TaskRunnerFactory

public TaskRunnerFactory(String name,
                         int priority,
                         boolean daemon,
                         int maxIterationsPerRun,
                         boolean dedicatedTaskRunner)

TaskRunnerFactory

public TaskRunnerFactory(String name,
                         int priority,
                         boolean daemon,
                         int maxIterationsPerRun,
                         boolean dedicatedTaskRunner,
                         int maxThreadPoolSize)
Method Detail

init

public void init()

shutdown

public void shutdown()
Performs a shutdown only, by which the thread pool is shutdown by not graceful nor aggressively.

See Also:
ThreadPoolUtils.shutdown(java.util.concurrent.ExecutorService)

shutdownNow

public void shutdownNow()
Performs a shutdown now (aggressively) on the thread pool.

See Also:
ThreadPoolUtils.shutdownNow(java.util.concurrent.ExecutorService)

shutdownGraceful

public void shutdownGraceful()
Performs a graceful shutdown.

See Also:
ThreadPoolUtils.shutdownGraceful(java.util.concurrent.ExecutorService)

createTaskRunner

public TaskRunner createTaskRunner(Task task,
                                   String name)

execute

public void execute(Runnable runnable)
Specified by:
execute in interface Executor

execute

public void execute(Runnable runnable,
                    String name)

createDefaultExecutor

protected ExecutorService createDefaultExecutor()

getExecutor

public ExecutorService getExecutor()

setExecutor

public void setExecutor(ExecutorService executor)

getMaxIterationsPerRun

public int getMaxIterationsPerRun()

setMaxIterationsPerRun

public void setMaxIterationsPerRun(int maxIterationsPerRun)

getName

public String getName()

setName

public void setName(String name)

getPriority

public int getPriority()

setPriority

public void setPriority(int priority)

isDaemon

public boolean isDaemon()

setDaemon

public void setDaemon(boolean daemon)

isDedicatedTaskRunner

public boolean isDedicatedTaskRunner()

setDedicatedTaskRunner

public void setDedicatedTaskRunner(boolean dedicatedTaskRunner)

getMaxThreadPoolSize

public int getMaxThreadPoolSize()

setMaxThreadPoolSize

public void setMaxThreadPoolSize(int maxThreadPoolSize)

getRejectedTaskHandler

public RejectedExecutionHandler getRejectedTaskHandler()

setRejectedTaskHandler

public void setRejectedTaskHandler(RejectedExecutionHandler rejectedTaskHandler)

getShutdownAwaitTermination

public long getShutdownAwaitTermination()

setShutdownAwaitTermination

public void setShutdownAwaitTermination(long shutdownAwaitTermination)


Copyright © 2005–2013 The Apache Software Foundation. All rights reserved.