public class HealthChecksThreadPool extends ThreadPoolExecutor
Metrics.HealthChecker
itself is executed in the pool too. For example for 10 health checks we have the
thread pool (4) + the queue (7) = 11 for the 10 health checks and the HealthChecker.
The RejectedExecutionHandler
is configured to drop oldest items in the queue as new ones come in, to avoid
running more than one health check in each recurrence period.ThreadPoolExecutor.AbortPolicy, ThreadPoolExecutor.CallerRunsPolicy, ThreadPoolExecutor.DiscardOldestPolicy, ThreadPoolExecutor.DiscardPolicy
Constructor and Description |
---|
HealthChecksThreadPool(com.codahale.metrics.health.HealthCheckRegistry healthCheckRegistry) |
Modifier and Type | Method and Description |
---|---|
protected void |
beforeExecute(Thread t,
Runnable r)
Manually handle the queue size so it doesn't grow over our calculated queue capacity based on the number of
health checks
|
static long |
getRejectedExecutions() |
afterExecute, allowCoreThreadTimeOut, allowsCoreThreadTimeOut, awaitTermination, execute, finalize, getActiveCount, getCompletedTaskCount, getCorePoolSize, getKeepAliveTime, getLargestPoolSize, getMaximumPoolSize, getPoolSize, getQueue, getRejectedExecutionHandler, getTaskCount, getThreadFactory, isShutdown, isTerminated, isTerminating, prestartAllCoreThreads, prestartCoreThread, purge, remove, setCorePoolSize, setKeepAliveTime, setMaximumPoolSize, setRejectedExecutionHandler, setThreadFactory, shutdown, shutdownNow, terminated, toString
invokeAll, invokeAll, invokeAny, invokeAny, newTaskFor, newTaskFor, submit, submit, submit
public HealthChecksThreadPool(com.codahale.metrics.health.HealthCheckRegistry healthCheckRegistry)
protected void beforeExecute(Thread t, Runnable r)
beforeExecute
in class ThreadPoolExecutor
@Restricted(value=org.kohsuke.accmod.restrictions.DoNotUse.class) public static long getRejectedExecutions()
Copyright © 2016–2019. All rights reserved.