Class ThreadPoolAsyncTaskExecutor

java.lang.Object
com.atlassian.plugin.osgi.spring.ThreadPoolAsyncTaskExecutor
All Implemented Interfaces:
Executor, org.springframework.core.task.AsyncTaskExecutor, org.springframework.core.task.TaskExecutor

public class ThreadPoolAsyncTaskExecutor extends Object implements org.springframework.core.task.AsyncTaskExecutor
Executes spring tasks using a cached thread pool that expands as necessary. Overrides the default Spring executor that spawns a new thread for every application context creation.
Since:
2.5.0
  • Constructor Details

    • ThreadPoolAsyncTaskExecutor

      public ThreadPoolAsyncTaskExecutor()
  • Method Details

    • execute

      public void execute(@Nonnull Runnable task, long startTimeout)
      Executes the runnable
      Specified by:
      execute in interface org.springframework.core.task.AsyncTaskExecutor
      Parameters:
      task - The runnable task
      startTimeout - The start timeout (ignored)
    • submit

      @Nonnull public Future<?> submit(@Nonnull Runnable task)
      Specified by:
      submit in interface org.springframework.core.task.AsyncTaskExecutor
    • submit

      @Nonnull public <T> Future<T> submit(@Nonnull Callable<T> task)
      Specified by:
      submit in interface org.springframework.core.task.AsyncTaskExecutor
    • execute

      public void execute(@Nonnull Runnable task)
      Executes the runnable
      Specified by:
      execute in interface Executor
      Specified by:
      execute in interface org.springframework.core.task.TaskExecutor
      Parameters:
      task - The runnable task
    • shutdown

      public void shutdown()
      Shuts down the internal ExecutorService to ensure that all threads are stopped in order to allow the JVM to terminate cleanly in a timely fashion.