Class ExecutorsFactory
- java.lang.Object
-
- jetbrains.buildServer.util.executors.ExecutorsFactory
-
public class ExecutorsFactory extends java.lang.Object
Factory for various thread pool executors. Should be used instead of standard JavaExecutors
class.- Since:
- 8.1.2
-
-
Constructor Summary
Constructors Constructor Description ExecutorsFactory()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.util.concurrent.ExecutorService
newDaemonExecutor(java.lang.String threadNamePrefix)
Creates not fixed thread pool executor with daemon threads.static java.util.concurrent.ExecutorService
newExecutor(java.lang.String threadNamePrefix)
Creates not fixed thread pool executor with non daemon threads.static java.util.concurrent.ExecutorService
newFixedDaemonExecutor(java.lang.String threadNamePrefix, int poolSize)
Creates fixed thread pool executor of specified size with daemon threads.static java.util.concurrent.ExecutorService
newFixedDaemonExecutor(java.lang.String threadNamePrefix, int minPoolSize, int maxPoolSize, int maxQueueSize)
Creates thread pool executor with specified number of minimum and maximum daemon threads.static java.util.concurrent.ExecutorService
newFixedExecutor(java.lang.String threadNamePrefix, int poolSize)
Creates fixed thread pool executor of specified size with non daemon threads.static java.util.concurrent.ScheduledExecutorService
newFixedScheduledDaemonExecutor(java.lang.String threadNamePrefix, int poolSize)
Creates fixed scheduled thread pool executor of specified size with daemon threads.static java.util.concurrent.ScheduledExecutorService
newFixedScheduledExecutor(java.lang.String threadNamePrefix, int poolSize)
Creates fixed scheduled thread pool executor of specified size with non daemon threads.static java.util.concurrent.ExecutorService
newSingleThreadedExecutor(java.lang.String threadNamePrefix)
Creates single-threaded pool executor with non daemon threads.
-
-
-
Method Detail
-
newFixedDaemonExecutor
@NotNull public static java.util.concurrent.ExecutorService newFixedDaemonExecutor(@NotNull java.lang.String threadNamePrefix, int poolSize)
Creates fixed thread pool executor of specified size with daemon threads.- Parameters:
threadNamePrefix
- prefix for thread namespoolSize
- size of the thread pool- Returns:
- new thread pool
- Since:
- 8.1.2
-
newFixedDaemonExecutor
@NotNull public static java.util.concurrent.ExecutorService newFixedDaemonExecutor(@NotNull java.lang.String threadNamePrefix, int minPoolSize, int maxPoolSize, int maxQueueSize)
Creates thread pool executor with specified number of minimum and maximum daemon threads. This executor also uses fixed size queue.- Parameters:
threadNamePrefix
- thread name prefixminPoolSize
- minimum number of threads to keep in poolmaxPoolSize
- maximum number of threadsmaxQueueSize
- maximum size of the queue- Returns:
- see above
- Since:
- 2018.2.1
-
newFixedExecutor
@NotNull public static java.util.concurrent.ExecutorService newFixedExecutor(@NotNull java.lang.String threadNamePrefix, int poolSize)
Creates fixed thread pool executor of specified size with non daemon threads.- Parameters:
threadNamePrefix
- prefix for thread namespoolSize
- size of the thread pool- Returns:
- new thread pool
- Since:
- 8.1.2
-
newFixedScheduledDaemonExecutor
@NotNull public static java.util.concurrent.ScheduledExecutorService newFixedScheduledDaemonExecutor(@NotNull java.lang.String threadNamePrefix, int poolSize)
Creates fixed scheduled thread pool executor of specified size with daemon threads.- Parameters:
threadNamePrefix
- prefix for thread namespoolSize
- size of the thread pool- Returns:
- new thread pool
- Since:
- 8.1.2
-
newFixedScheduledExecutor
@NotNull public static java.util.concurrent.ScheduledExecutorService newFixedScheduledExecutor(@NotNull java.lang.String threadNamePrefix, int poolSize)
Creates fixed scheduled thread pool executor of specified size with non daemon threads.- Parameters:
threadNamePrefix
- prefix for thread namespoolSize
- size of the thread pool- Returns:
- new thread pool
- Since:
- 8.1.2
-
newDaemonExecutor
@NotNull public static java.util.concurrent.ExecutorService newDaemonExecutor(@NotNull java.lang.String threadNamePrefix)
Creates not fixed thread pool executor with daemon threads.- Parameters:
threadNamePrefix
- prefix for thread names- Returns:
- new thread pool
- Since:
- 8.1.2
-
newExecutor
@NotNull public static java.util.concurrent.ExecutorService newExecutor(@NotNull java.lang.String threadNamePrefix)
Creates not fixed thread pool executor with non daemon threads.- Parameters:
threadNamePrefix
- prefix for thread names- Returns:
- new thread pool
- Since:
- 8.1.2
-
newSingleThreadedExecutor
@NotNull public static java.util.concurrent.ExecutorService newSingleThreadedExecutor(@NotNull java.lang.String threadNamePrefix)
Creates single-threaded pool executor with non daemon threads.
Similar toExecutors.newSingleThreadExecutor()
, tasks are guaranteed to execute sequentially, and no more than one task will be active at any given time, unless number of threads is increased explicitly- Parameters:
threadNamePrefix
- prefix for thread names- Returns:
- new thread pool
- Since:
- 2018.1
-
-