Package org.languagetool.tools
Class LtThreadPoolExecutor
java.lang.Object
java.util.concurrent.AbstractExecutorService
java.util.concurrent.ThreadPoolExecutor
org.languagetool.tools.LtThreadPoolExecutor
- All Implemented Interfaces:
AutoCloseable,Executor,ExecutorService
ThreadPoolExecutor with some stopping logic for OOM and metrics tracking
-
Nested Class Summary
Nested classes/interfaces inherited from class java.util.concurrent.ThreadPoolExecutor
ThreadPoolExecutor.AbortPolicy, ThreadPoolExecutor.CallerRunsPolicy, ThreadPoolExecutor.DiscardOldestPolicy, ThreadPoolExecutor.DiscardPolicy -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final io.prometheus.client.Gaugeprivate static final io.prometheus.client.Gaugeprivate final Stringprivate static final io.prometheus.client.Gauge -
Constructor Summary
ConstructorsConstructorDescriptionLtThreadPoolExecutor(String name, int corePoolSize, int maximumPoolSize, long keepAliveTime, TimeUnit unit, BlockingQueue<Runnable> workQueue, ThreadFactory threadFactory, RejectedExecutionHandler handler) -
Method Summary
Modifier and TypeMethodDescriptionprotected voidafterExecute(Runnable r, Throwable t) protected voidbeforeExecute(Thread t, Runnable r) voidbooleanMethods inherited from class java.util.concurrent.ThreadPoolExecutor
allowCoreThreadTimeOut, allowsCoreThreadTimeOut, awaitTermination, finalize, getActiveCount, getCompletedTaskCount, getCorePoolSize, getKeepAliveTime, getLargestPoolSize, getMaximumPoolSize, getPoolSize, getQueue, getRejectedExecutionHandler, getTaskCount, getThreadFactory, isShutdown, isTerminated, isTerminating, prestartAllCoreThreads, prestartCoreThread, purge, setCorePoolSize, setKeepAliveTime, setMaximumPoolSize, setRejectedExecutionHandler, setThreadFactory, shutdown, shutdownNow, terminated, toStringMethods inherited from class java.util.concurrent.AbstractExecutorService
invokeAll, invokeAll, invokeAny, invokeAny, newTaskFor, newTaskFor, submit, submit, submitMethods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface java.util.concurrent.ExecutorService
close
-
Field Details
-
maxQueueSize
private static final io.prometheus.client.Gauge maxQueueSize -
queueSize
private static final io.prometheus.client.Gauge queueSize -
largestPoolSize
private static final io.prometheus.client.Gauge largestPoolSize -
name
-
-
Constructor Details
-
LtThreadPoolExecutor
LtThreadPoolExecutor(String name, int corePoolSize, int maximumPoolSize, long keepAliveTime, @NotNull TimeUnit unit, @NotNull BlockingQueue<Runnable> workQueue, @NotNull ThreadFactory threadFactory, @NotNull RejectedExecutionHandler handler)
-
-
Method Details
-
execute
- Specified by:
executein interfaceExecutor- Overrides:
executein classThreadPoolExecutor
-
remove
- Overrides:
removein classThreadPoolExecutor
-
afterExecute
- Overrides:
afterExecutein classThreadPoolExecutor
-
beforeExecute
- Overrides:
beforeExecutein classThreadPoolExecutor
-