Class DefaultAsyncTaskExecutor

java.lang.Object
org.flowable.common.engine.impl.async.DefaultAsyncTaskExecutor
All Implemented Interfaces:
AsyncTaskExecutor

public class DefaultAsyncTaskExecutor extends Object implements AsyncTaskExecutor
Author:
Joram Barrez, Tijs Rademakers, Filip Hrisafov
  • Field Details

    • logger

      protected final org.slf4j.Logger logger
    • configuration

      protected final AsyncTaskExecutorConfiguration configuration
    • executorService

      protected ExecutorService executorService
      The executor service used for task execution.
    • executorNeedsShutdown

      protected boolean executorNeedsShutdown
      Whether the executor needs a shutdown. This is true if the executor service has not been set from the outside.
    • threadPoolQueue

      protected BlockingQueue<Runnable> threadPoolQueue
      The queue used for job execution work
    • threadFactory

      protected ThreadFactory threadFactory
    • rejectedExecutionHandler

      protected RejectedExecutionHandler rejectedExecutionHandler
  • Constructor Details

    • DefaultAsyncTaskExecutor

      public DefaultAsyncTaskExecutor()
    • DefaultAsyncTaskExecutor

      public DefaultAsyncTaskExecutor(AsyncTaskExecutorConfiguration configuration)
  • Method Details

    • execute

      public void execute(Runnable task)
      Description copied from interface: AsyncTaskExecutor
      Execute the given task
      Specified by:
      execute in interface AsyncTaskExecutor
      Parameters:
      task - the Runnable task to execute
    • submit

      public CompletableFuture<?> submit(Runnable task)
      Description copied from interface: AsyncTaskExecutor
      Submit a Runnable task for execution, receiving a Future representing the execution of the task.
      Specified by:
      submit in interface AsyncTaskExecutor
      Parameters:
      task - the Runnable to execute
      Returns:
      a CompletableFuture representing pending completion of the task
    • submit

      public <T> CompletableFuture<T> submit(Callable<T> task)
      Description copied from interface: AsyncTaskExecutor
      Submit a Callable task for execution, receiving a Future representing the execution of the task.
      Specified by:
      submit in interface AsyncTaskExecutor
      Parameters:
      task - the Runnable 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 interface AsyncTaskExecutor
    • initializeExecutor

      protected ExecutorService initializeExecutor()
    • getConfiguration

      public AsyncTaskExecutorConfiguration 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

      public BlockingQueue<Runnable> getThreadPoolQueue()
    • setThreadPoolQueue

      public void setThreadPoolQueue(BlockingQueue<Runnable> threadPoolQueue)
    • getThreadPoolNamingPattern

      public String getThreadPoolNamingPattern()
    • setThreadPoolNamingPattern

      public void setThreadPoolNamingPattern(String threadPoolNamingPattern)
    • getThreadFactory

      public ThreadFactory getThreadFactory()
    • setThreadFactory

      public void setThreadFactory(ThreadFactory threadFactory)
    • getRejectedExecutionHandler

      public RejectedExecutionHandler getRejectedExecutionHandler()
    • setRejectedExecutionHandler

      public void setRejectedExecutionHandler(RejectedExecutionHandler rejectedExecutionHandler)
    • getRemainingCapacity

      public int getRemainingCapacity()
      Specified by:
      getRemainingCapacity in interface AsyncTaskExecutor