Package org.languagetool.tools
Class LtThreadPoolFactory
java.lang.Object
org.languagetool.tools.LtThreadPoolFactory
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static class -
Field Summary
FieldsModifier and TypeFieldDescription(package private) static final ThreadPoolExecutorprivate static final ConcurrentMap<String, ThreadPoolExecutor> private static final LtThreadPoolFactory.LtRejectedExecutionHandlerprivate static final io.prometheus.client.Counterstatic final Stringstatic final intstatic final Stringstatic final Stringprivate static final io.prometheus.client.Gauge -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic ThreadPoolExecutorcreateFixedThreadPoolExecutor(String identifier, int maxThreads, int maxTaskInQueue, boolean isDaemon, Thread.UncaughtExceptionHandler exceptionHandler, boolean reuse) static ThreadPoolExecutorcreateFixedThreadPoolExecutor(String identifier, int corePool, int maxThreads, int maxTaskInQueue, long keepAliveTimeSeconds, boolean isDaemon, Thread.UncaughtExceptionHandler exceptionHandler, boolean reuse) static Optional<ThreadPoolExecutor> getFixedThreadPoolExecutor(String identifier) private static ThreadPoolExecutorgetNewThreadPoolExecutor(String identifier, int corePool, int maxThreads, int maxTaskInQueue, long keepAliveTimeSeconds, boolean isDaemon, Thread.UncaughtExceptionHandler exceptionHandler)
-
Field Details
-
SERVER_POOL
- See Also:
-
TEXT_CHECKER_POOL
- See Also:
-
REMOTE_RULE_EXECUTING_POOL
- See Also:
-
REMOTE_RULE_POOL_SIZE_FACTOR
public static final int REMOTE_RULE_POOL_SIZE_FACTOR- See Also:
-
executorServices
-
rejectedTasks
private static final io.prometheus.client.Counter rejectedTasks -
threadGauge
private static final io.prometheus.client.Gauge threadGauge -
handler
-
defaultPool
-
-
Constructor Details
-
LtThreadPoolFactory
private LtThreadPoolFactory()
-
-
Method Details
-
createFixedThreadPoolExecutor
public static ThreadPoolExecutor createFixedThreadPoolExecutor(@NotNull String identifier, int maxThreads, int maxTaskInQueue, boolean isDaemon, @NotNull Thread.UncaughtExceptionHandler exceptionHandler, boolean reuse) - Parameters:
identifier- Name of the thread-pool, will be used as name of the threads in the threadPoolmaxThreads- Number of parallel threads running in this poolmaxTaskInQueue- Number of maximum Task in the pool queueisDaemon- Run the threads as daemon threadsexceptionHandler- Handler for exceptions in Threadreuse- True if thread-pool should be reused- Returns:
- a Fixed ThreadPoolExecutor
-
createFixedThreadPoolExecutor
public static ThreadPoolExecutor createFixedThreadPoolExecutor(@NotNull String identifier, int corePool, int maxThreads, int maxTaskInQueue, long keepAliveTimeSeconds, boolean isDaemon, @NotNull Thread.UncaughtExceptionHandler exceptionHandler, boolean reuse) - Parameters:
identifier- Name of the thread-pool, will be used as name of the threads in the threadPoolcorePool- Number of core pool threadsmaxThreads- Maximum number of parallel threads running in this poolmaxTaskInQueue- Number of maximum Task in the pool queuekeepAliveTimeSeconds- keep-alive time for idle threadsisDaemon- Run the threads as daemon threadsexceptionHandler- Handler for exceptions in Threadreuse- True if thread-pool should be reused- Returns:
- a Fixed ThreadPoolExecutor
-
getNewThreadPoolExecutor
@NotNull private static ThreadPoolExecutor getNewThreadPoolExecutor(@NotNull String identifier, int corePool, int maxThreads, int maxTaskInQueue, long keepAliveTimeSeconds, boolean isDaemon, @NotNull Thread.UncaughtExceptionHandler exceptionHandler) -
getFixedThreadPoolExecutor
- Parameters:
identifier- Name of an already created tread-pool- Returns:
- An optional of ThreadPoolExecutor (Null or Object)
-