Package org.apache.activemq.thread
Class TaskRunnerFactory
java.lang.Object
org.apache.activemq.thread.TaskRunnerFactory
- All Implemented Interfaces:
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 somewhat like
cooperative multitasking.
-
Constructor Summary
ConstructorsConstructorDescriptionTaskRunnerFactory(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
Modifier and TypeMethodDescriptionprotected ExecutorServicecreateTaskRunner(Task task, String name) voidvoidintintgetName()intlongvoidinit()booleanisDaemon()booleanvoidsetDaemon(boolean daemon) voidsetDedicatedTaskRunner(boolean dedicatedTaskRunner) voidsetExecutor(ExecutorService executor) voidsetMaxIterationsPerRun(int maxIterationsPerRun) voidsetMaxThreadPoolSize(int maxThreadPoolSize) voidvoidsetPriority(int priority) voidsetRejectedTaskHandler(RejectedExecutionHandler rejectedTaskHandler) voidsetShutdownAwaitTermination(long shutdownAwaitTermination) voidsetThreadClassLoader(ClassLoader threadClassLoader) voidshutdown()Performs a shutdown only, by which the thread pool is shutdown by not graceful nor aggressively.voidPerforms a graceful shutdown.voidPerforms a shutdown now (aggressively) on the thread pool.
-
Constructor Details
-
TaskRunnerFactory
public TaskRunnerFactory() -
TaskRunnerFactory
-
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 Details
-
init
public void init() -
shutdown
public void shutdown()Performs a shutdown only, by which the thread pool is shutdown by not graceful nor aggressively. -
shutdownNow
public void shutdownNow()Performs a shutdown now (aggressively) on the thread pool. -
shutdownGraceful
public void shutdownGraceful()Performs a graceful shutdown. -
createTaskRunner
-
execute
-
execute
-
createDefaultExecutor
-
getExecutor
-
setExecutor
-
getMaxIterationsPerRun
public int getMaxIterationsPerRun() -
setMaxIterationsPerRun
public void setMaxIterationsPerRun(int maxIterationsPerRun) -
getName
-
setName
-
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) -
setThreadClassLoader
-
getRejectedTaskHandler
-
setRejectedTaskHandler
-
getShutdownAwaitTermination
public long getShutdownAwaitTermination() -
setShutdownAwaitTermination
public void setShutdownAwaitTermination(long shutdownAwaitTermination)
-