use of com.navercorp.pinpoint.common.profiler.concurrent.PinpointThreadFactory in project pinpoint by naver.
the class DefaultChannelzScheduledReporter method newScheduledExecutorService.
private ScheduledExecutorService newScheduledExecutorService() {
String threadName = PinpointThreadFactory.DEFAULT_THREAD_NAME_PREFIX + DefaultChannelzScheduledReporter.class.getSimpleName();
ThreadFactory threadFactory = new PinpointThreadFactory(threadName, true);
return new ScheduledThreadPoolExecutor(1, threadFactory);
}
use of com.navercorp.pinpoint.common.profiler.concurrent.PinpointThreadFactory in project pinpoint by naver.
the class ActiveThreadCountHandler method start.
@Override
public void start() {
PinpointThreadFactory flushThreadFactory = new PinpointThreadFactory(ClassUtils.simpleClassName(this) + "-Flush-Thread", true);
webSocketFlushExecutor = new SimpleOrderedThreadPool(CpuUtils.cpuCount(), 65535, flushThreadFactory);
flushTimer = newJavaTimer(ClassUtils.simpleClassName(this) + "-Flush-Timer");
healthCheckTimer = newJavaTimer(ClassUtils.simpleClassName(this) + "-HealthCheck-Timer");
reactiveTimer = newJavaTimer(ClassUtils.simpleClassName(this) + "-Reactive-Timer");
}
use of com.navercorp.pinpoint.common.profiler.concurrent.PinpointThreadFactory in project pinpoint by naver.
the class DefaultAgent method registerStopHandler.
@Override
public void registerStopHandler() {
if (applicationContext instanceof DefaultApplicationContext) {
logger.info("registerStopHandler");
DefaultApplicationContext context = (DefaultApplicationContext) applicationContext;
ShutdownHookRegisterProvider shutdownHookRegisterProvider = context.getShutdownHookRegisterProvider();
ShutdownHookRegister shutdownHookRegister = shutdownHookRegisterProvider.get();
PinpointThreadFactory pinpointThreadFactory = new PinpointThreadFactory("Pinpoint-shutdown-hook", false);
Thread shutdownThread = pinpointThreadFactory.newThread(new Runnable() {
@Override
public void run() {
logger.info("stop() started. threadName:" + Thread.currentThread().getName());
DefaultAgent.this.stop();
}
});
shutdownHookRegister.register(shutdownThread);
}
}
use of com.navercorp.pinpoint.common.profiler.concurrent.PinpointThreadFactory in project pinpoint by naver.
the class DefaultChannelFactory method newExecutorService.
private ExecutorService newExecutorService(String name, int executorQueueSize) {
ThreadFactory threadFactory = new PinpointThreadFactory(PinpointThreadFactory.DEFAULT_THREAD_NAME_PREFIX + name, true);
BlockingQueue<Runnable> workQueue = new LinkedBlockingQueue<>(executorQueueSize);
return new ThreadPoolExecutor(1, 1, 0L, TimeUnit.MILLISECONDS, workQueue, threadFactory);
}
use of com.navercorp.pinpoint.common.profiler.concurrent.PinpointThreadFactory in project pinpoint by naver.
the class SimpleOrderedThreadPoolTest method testExecute.
@Test
public void testExecute() throws Exception {
SimpleOrderedThreadPool threadPool = new SimpleOrderedThreadPool(3, 100, new PinpointThreadFactory("test", true));
int testCount = 100;
CountDownLatch latch = new CountDownLatch(testCount);
for (int i = 0; i < testCount; i++) {
final int selectKey = random.nextInt();
threadPool.execute(new TestHashSelectorRunnable(selectKey, latch));
}
threadPool.shutdown();
threadPool.awaitTermination(10000, TimeUnit.MILLISECONDS);
Assert.assertEquals(latch.getCount(), 0);
}
Aggregations