Class SimpleExecutorServices
- java.lang.Object
-
- jetbrains.buildServer.serverSide.impl.executors.SimpleExecutorServices
-
- All Implemented Interfaces:
PerPluginAwareRegistry
,ExecutorServices
,ExecutorServicesController
- Direct Known Subclasses:
TeamCityExecutorServicesImpl
public class SimpleExecutorServices extends Object implements ExecutorServices, ExecutorServicesController, PerPluginAwareRegistry
-
-
Field Summary
Fields Modifier and Type Field Description static String
NORMAL_EXECUTOR_CORE_THREADS_NUM_PROP
static String
NORMAL_EXECUTOR_MAX_THREADS_PROP
-
Constructor Summary
Constructors Constructor Description SimpleExecutorServices()
SimpleExecutorServices(ServerMetrics serverMetrics)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
awaitTermination(long timeout, TimeUnit unit)
Blocks until all tasks have completed execution after a shutdown request, or the timeout occurs, or the current thread is interrupted, whichever happens first.DisposablePerPluginRegistry
createWrapper(String pluginUUID)
ScalingThreadPoolExecutor
findExecutorByName(String name)
ExecutorService
getLowPriorityExecutorService()
ScheduledExecutorService
getNormalExecutorService()
protected DeferringExecutorService
initScalingExecutor(String threadPoolName, String propertyPrefix, int coreSize, int maxSize, int queueSize, int keepAliveSeconds)
boolean
isShutdown()
boolean
isTerminated()
Returns true if all tasks have completed following shut down.void
shutdownGracefully()
void
shutdownNow()
void
start()
-
-
-
Field Detail
-
NORMAL_EXECUTOR_MAX_THREADS_PROP
public static final String NORMAL_EXECUTOR_MAX_THREADS_PROP
- See Also:
- Constant Field Values
-
NORMAL_EXECUTOR_CORE_THREADS_NUM_PROP
public static final String NORMAL_EXECUTOR_CORE_THREADS_NUM_PROP
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
SimpleExecutorServices
public SimpleExecutorServices()
-
SimpleExecutorServices
public SimpleExecutorServices(@Nullable ServerMetrics serverMetrics)
-
-
Method Detail
-
initScalingExecutor
@NotNull protected final DeferringExecutorService initScalingExecutor(@NotNull String threadPoolName, @NotNull String propertyPrefix, int coreSize, int maxSize, int queueSize, int keepAliveSeconds)
-
getNormalExecutorService
@NotNull public ScheduledExecutorService getNormalExecutorService()
- Specified by:
getNormalExecutorService
in interfaceExecutorServices
- Returns:
- normal executor service; this executor is being used mostly for high priority/critical tasks.
If a task is not critical, consider using
ExecutorServices.getLowPriorityExecutorService()
instead.
-
getLowPriorityExecutorService
@NotNull public ExecutorService getLowPriorityExecutorService()
- Specified by:
getLowPriorityExecutorService
in interfaceExecutorServices
- Returns:
- low priority executor service; this executor can be used for any background non-critical tasks.
-
start
public void start()
- Specified by:
start
in interfaceExecutorServicesController
-
shutdownGracefully
public void shutdownGracefully()
- Specified by:
shutdownGracefully
in interfaceExecutorServicesController
-
shutdownNow
public void shutdownNow()
- Specified by:
shutdownNow
in interfaceExecutorServicesController
-
isShutdown
public boolean isShutdown()
- Specified by:
isShutdown
in interfaceExecutorServicesController
-
isTerminated
public boolean isTerminated()
Description copied from interface:ExecutorServicesController
Returns true if all tasks have completed following shut down. Note that isTerminated is never true unless either shutdown or shutdownNow was called first.- Specified by:
isTerminated
in interfaceExecutorServicesController
- Returns:
- true if all tasks have completed following shut down
-
awaitTermination
public boolean awaitTermination(long timeout, @NotNull TimeUnit unit) throws InterruptedException
Description copied from interface:ExecutorServicesController
Blocks until all tasks have completed execution after a shutdown request, or the timeout occurs, or the current thread is interrupted, whichever happens first.- Specified by:
awaitTermination
in interfaceExecutorServicesController
- Parameters:
timeout
- the maximum time to waitunit
- the time unit of the timeout argument- Returns:
- true if this executor terminated and false if the timeout elapsed before termination
- Throws:
InterruptedException
- if interrupted while waiting
-
createWrapper
@NotNull public DisposablePerPluginRegistry createWrapper(@NotNull String pluginUUID)
- Specified by:
createWrapper
in interfacePerPluginAwareRegistry
-
findExecutorByName
@Nullable @TestOnly public ScalingThreadPoolExecutor findExecutorByName(@NotNull String name)
-
-