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 AsyncTaskExecutorConfiguration
protected boolean
Whether the executor needs a shutdown.protected ExecutorService
The executor service used for task execution.protected final org.slf4j.Logger
protected RejectedExecutionHandler
protected ThreadFactory
protected BlockingQueue<Runnable>
The queue used for job execution work -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
Execute the giventask
int
long
int
int
int
long
protected ExecutorService
boolean
void
setAllowCoreThreadTimeout
(boolean allowCoreThreadTimeout) void
setCorePoolSize
(int corePoolSize) void
setKeepAliveTime
(long keepAliveTime) void
setMaxPoolSize
(int maxPoolSize) void
setQueueSize
(int queueSize) void
setRejectedExecutionHandler
(RejectedExecutionHandler rejectedExecutionHandler) void
setSecondsToWaitOnShutdown
(long secondsToWaitOnShutdown) void
setThreadFactory
(ThreadFactory threadFactory) void
setThreadPoolNamingPattern
(String threadPoolNamingPattern) void
setThreadPoolQueue
(BlockingQueue<Runnable> threadPoolQueue) void
shutdown()
Potentially shutdown the resources used by the async task executor.void
start()
Submit aRunnable
task for execution, receiving a Future representing the execution of the task.<T> CompletableFuture<T>
Submit aCallable
task 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:AsyncTaskExecutor
Execute the giventask
- Specified by:
execute
in interfaceAsyncTaskExecutor
- Parameters:
task
- theRunnable
task to execute
-
submit
Description copied from interface:AsyncTaskExecutor
Submit aRunnable
task for execution, receiving a Future representing the execution of the task.- Specified by:
submit
in interfaceAsyncTaskExecutor
- Parameters:
task
- theRunnable
to execute- Returns:
- a
CompletableFuture
representing pending completion of the task
-
submit
Description copied from interface:AsyncTaskExecutor
Submit aCallable
task for execution, receiving a Future representing the execution of the task.- Specified by:
submit
in interfaceAsyncTaskExecutor
- Parameters:
task
- theRunnable
to execute- Returns:
- a
CompletableFuture
representing pending completion of the task
-
start
public void start() -
shutdown
public void shutdown()Description copied from interface:AsyncTaskExecutor
Potentially shutdown the resources used by the async task executor.- Specified by:
shutdown
in 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:
getRemainingCapacity
in interfaceAsyncTaskExecutor
-