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 StringNORMAL_EXECUTOR_CORE_THREADS_NUM_PROPstatic StringNORMAL_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 booleanawaitTermination(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.DisposablePerPluginRegistrycreateWrapper(String pluginUUID)ScalingThreadPoolExecutorfindExecutorByName(String name)ExecutorServicegetLowPriorityExecutorService()ScheduledExecutorServicegetNormalExecutorService()protected DeferringExecutorServiceinitScalingExecutor(String threadPoolName, String propertyPrefix, int coreSize, int maxSize, int queueSize, int keepAliveSeconds)booleanisShutdown()booleanisTerminated()Returns true if all tasks have completed following shut down.voidshutdownGracefully()voidshutdownNow()voidstart()
-
-
-
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:
getNormalExecutorServicein 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:
getLowPriorityExecutorServicein interfaceExecutorServices- Returns:
- low priority executor service; this executor can be used for any background non-critical tasks.
-
start
public void start()
- Specified by:
startin interfaceExecutorServicesController
-
shutdownGracefully
public void shutdownGracefully()
- Specified by:
shutdownGracefullyin interfaceExecutorServicesController
-
shutdownNow
public void shutdownNow()
- Specified by:
shutdownNowin interfaceExecutorServicesController
-
isShutdown
public boolean isShutdown()
- Specified by:
isShutdownin interfaceExecutorServicesController
-
isTerminated
public boolean isTerminated()
Description copied from interface:ExecutorServicesControllerReturns 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:
isTerminatedin interfaceExecutorServicesController- Returns:
- true if all tasks have completed following shut down
-
awaitTermination
public boolean awaitTermination(long timeout, @NotNull TimeUnit unit) throws InterruptedExceptionDescription copied from interface:ExecutorServicesControllerBlocks 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:
awaitTerminationin 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:
createWrapperin interfacePerPluginAwareRegistry
-
findExecutorByName
@Nullable @TestOnly public ScalingThreadPoolExecutor findExecutorByName(@NotNull String name)
-
-