Class DefaultAsyncTaskExecutor
java.lang.Object
org.flowable.common.engine.impl.async.DefaultAsyncTaskExecutor
- All Implemented Interfaces:
AsyncTaskExecutor
- Author:
- Joram Barrez, Tijs Rademakers, Filip Hrisafov
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final AsyncTaskExecutorConfigurationprotected booleanWhether the executor needs a shutdown.protected ExecutorServiceThe executor service used for task execution.protected final org.slf4j.Loggerprotected RejectedExecutionHandlerprotected ThreadFactoryprotected BlockingQueue<Runnable>The queue used for job execution work -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidExecute the giventaskintlongintintintlongprotected ExecutorServicebooleanvoidsetAllowCoreThreadTimeout(boolean allowCoreThreadTimeout) voidsetCorePoolSize(int corePoolSize) voidsetKeepAliveTime(long keepAliveTime) voidsetMaxPoolSize(int maxPoolSize) voidsetQueueSize(int queueSize) voidsetRejectedExecutionHandler(RejectedExecutionHandler rejectedExecutionHandler) voidsetSecondsToWaitOnShutdown(long secondsToWaitOnShutdown) voidsetThreadFactory(ThreadFactory threadFactory) voidsetThreadPoolNamingPattern(String threadPoolNamingPattern) voidsetThreadPoolQueue(BlockingQueue<Runnable> threadPoolQueue) voidshutdown()Potentially shutdown the resources used by the async task executor.voidstart()Submit aRunnabletask for execution, receiving a Future representing the execution of the task.<T> CompletableFuture<T>Submit aCallabletask for execution, receiving a Future representing the execution of the task.
-
Field Details
-
logger
protected final org.slf4j.Logger logger -
configuration
-
executorService
The executor service used for task execution. -
executorNeedsShutdown
protected boolean executorNeedsShutdownWhether the executor needs a shutdown. This is true if the executor service has not been set from the outside. -
threadPoolQueue
The queue used for job execution work -
threadFactory
-
rejectedExecutionHandler
-
-
Constructor Details
-
DefaultAsyncTaskExecutor
public DefaultAsyncTaskExecutor() -
DefaultAsyncTaskExecutor
-
-
Method Details
-
execute
Description copied from interface:AsyncTaskExecutorExecute the giventask- Specified by:
executein interfaceAsyncTaskExecutor- Parameters:
task- theRunnabletask to execute
-
submit
Description copied from interface:AsyncTaskExecutorSubmit aRunnabletask for execution, receiving a Future representing the execution of the task.- Specified by:
submitin interfaceAsyncTaskExecutor- Parameters:
task- theRunnableto execute- Returns:
- a
CompletableFuturerepresenting pending completion of the task
-
submit
Description copied from interface:AsyncTaskExecutorSubmit aCallabletask for execution, receiving a Future representing the execution of the task.- Specified by:
submitin interfaceAsyncTaskExecutor- Parameters:
task- theRunnableto execute- Returns:
- a
CompletableFuturerepresenting pending completion of the task
-
start
public void start() -
shutdown
public void shutdown()Description copied from interface:AsyncTaskExecutorPotentially shutdown the resources used by the async task executor.- Specified by:
shutdownin interfaceAsyncTaskExecutor
-
initializeExecutor
-
getConfiguration
-
getCorePoolSize
public int getCorePoolSize() -
setCorePoolSize
public void setCorePoolSize(int corePoolSize) -
getMaxPoolSize
public int getMaxPoolSize() -
setMaxPoolSize
public void setMaxPoolSize(int maxPoolSize) -
getKeepAliveTime
public long getKeepAliveTime() -
setKeepAliveTime
public void setKeepAliveTime(long keepAliveTime) -
getQueueSize
public int getQueueSize() -
setQueueSize
public void setQueueSize(int queueSize) -
isAllowCoreThreadTimeout
public boolean isAllowCoreThreadTimeout() -
setAllowCoreThreadTimeout
public void setAllowCoreThreadTimeout(boolean allowCoreThreadTimeout) -
getSecondsToWaitOnShutdown
public long getSecondsToWaitOnShutdown() -
setSecondsToWaitOnShutdown
public void setSecondsToWaitOnShutdown(long secondsToWaitOnShutdown) -
getThreadPoolQueue
-
setThreadPoolQueue
-
getThreadPoolNamingPattern
-
setThreadPoolNamingPattern
-
getThreadFactory
-
setThreadFactory
-
getRejectedExecutionHandler
-
setRejectedExecutionHandler
-
getRemainingCapacity
public int getRemainingCapacity()- Specified by:
getRemainingCapacityin interfaceAsyncTaskExecutor
-