Search in sources :

Example 1 with ThreadPoolExecutorEx

use of org.apache.servicecomb.core.executor.ThreadPoolExecutorEx in project java-chassis by ServiceComb.

the class ThreadPoolMetersInitializer method createThreadPoolMeters.

protected void createThreadPoolMeters(String threadPoolName, Executor executor) {
    if (!ThreadPoolExecutor.class.isInstance(executor)) {
        return;
    }
    ThreadPoolMonitor.attach(registry, (ThreadPoolExecutor) executor, threadPoolName);
    if (executor instanceof ThreadPoolExecutorEx) {
        Tag idTag = new BasicTag("id", threadPoolName);
        PolledMeter.using(registry).withName(REJECTED_COUNT).withTag(idTag).monitorMonotonicCounter((ThreadPoolExecutorEx) executor, ThreadPoolExecutorEx::getRejectedCount);
    }
}
Also used : BasicTag(com.netflix.spectator.api.BasicTag) ThreadPoolExecutorEx(org.apache.servicecomb.core.executor.ThreadPoolExecutorEx) ThreadPoolExecutor(java.util.concurrent.ThreadPoolExecutor) Tag(com.netflix.spectator.api.Tag) BasicTag(com.netflix.spectator.api.BasicTag)

Aggregations

BasicTag (com.netflix.spectator.api.BasicTag)1 Tag (com.netflix.spectator.api.Tag)1 ThreadPoolExecutor (java.util.concurrent.ThreadPoolExecutor)1 ThreadPoolExecutorEx (org.apache.servicecomb.core.executor.ThreadPoolExecutorEx)1