Search in sources :

Example 6 with PinpointThreadFactory

use of com.navercorp.pinpoint.common.profiler.concurrent.PinpointThreadFactory in project pinpoint by naver.

the class HbaseTemplate2 method afterPropertiesSet.

@Override
public void afterPropertiesSet() {
    Configuration configuration = getConfiguration();
    Objects.requireNonNull(configuration, "configuration is required");
    Objects.requireNonNull(getTableFactory(), "tableFactory is required");
    PinpointThreadFactory parallelScannerThreadFactory = new PinpointThreadFactory("Pinpoint-parallel-scanner", true);
    if (this.maxThreadsPerParallelScan <= 1) {
        this.enableParallelScan = false;
        this.executor = Executors.newSingleThreadExecutor(parallelScannerThreadFactory);
    } else {
        this.executor = ExecutorFactory.newFixedThreadPool(this.maxThreads, 1024, parallelScannerThreadFactory);
    }
}
Also used : Configuration(org.apache.hadoop.conf.Configuration) PinpointThreadFactory(com.navercorp.pinpoint.common.profiler.concurrent.PinpointThreadFactory)

Example 7 with PinpointThreadFactory

use of com.navercorp.pinpoint.common.profiler.concurrent.PinpointThreadFactory in project pinpoint by naver.

the class AsyncQueueingExecutor method createExecuteThread.

private Thread createExecuteThread(String executorName) {
    final ThreadFactory threadFactory = new PinpointThreadFactory(executorName, true);
    Thread thread = threadFactory.newThread(this);
    thread.start();
    return thread;
}
Also used : ThreadFactory(java.util.concurrent.ThreadFactory) PinpointThreadFactory(com.navercorp.pinpoint.common.profiler.concurrent.PinpointThreadFactory) PinpointThreadFactory(com.navercorp.pinpoint.common.profiler.concurrent.PinpointThreadFactory)

Example 8 with PinpointThreadFactory

use of com.navercorp.pinpoint.common.profiler.concurrent.PinpointThreadFactory in project pinpoint by naver.

the class ZookeeperJobWorker method start.

public void start() {
    final ThreadFactory threadFactory = new PinpointThreadFactory(this.getClass().getSimpleName(), true);
    this.workerThread = threadFactory.newThread(this);
    switch(this.workerState.getCurrentState()) {
        case NEW:
            if (this.workerState.changeStateInitializing()) {
                logger.info("start() started.");
                workerState.changeStateStarted();
                this.workerThread.start();
                logger.info("start() completed.");
                break;
            }
        case INITIALIZING:
            logger.info("start() failed. cause: already initializing.");
            break;
        case STARTED:
            logger.info("start() failed. cause: already initializing.");
            break;
        case DESTROYING:
            throw new IllegalStateException("Already destroying.");
        case STOPPED:
            throw new IllegalStateException(ClassUtils.simpleClassName(this) + " start() failed. caused:Already stopped.");
        case ILLEGAL_STATE:
            throw new IllegalStateException(ClassUtils.simpleClassName(this) + " start() failed. caused:Invalid State.");
    }
}
Also used : PinpointThreadFactory(com.navercorp.pinpoint.common.profiler.concurrent.PinpointThreadFactory) ThreadFactory(java.util.concurrent.ThreadFactory) PinpointThreadFactory(com.navercorp.pinpoint.common.profiler.concurrent.PinpointThreadFactory)

Example 9 with PinpointThreadFactory

use of com.navercorp.pinpoint.common.profiler.concurrent.PinpointThreadFactory in project pinpoint by naver.

the class ReconnectSchedulerProvider method get.

@Override
public ScheduledExecutorService get() {
    final PinpointThreadFactory threadFactory = new PinpointThreadFactory("Pinpoint-reconnect-thread");
    final ScheduledThreadPoolExecutor scheduler = (ScheduledThreadPoolExecutor) Executors.newScheduledThreadPool(1, threadFactory);
    // not recommended
    // LoggingRejectedExecutionHandler reconnectScheduler = new LoggingRejectedExecutionHandler("ReconnectScheduler");
    // scheduler.setRejectedExecutionHandler(reconnectScheduler);
    ScheduledExecutorService scheduledExecutorService = Executors.unconfigurableScheduledExecutorService(scheduler);
    return scheduledExecutorService;
}
Also used : ScheduledExecutorService(java.util.concurrent.ScheduledExecutorService) ScheduledThreadPoolExecutor(java.util.concurrent.ScheduledThreadPoolExecutor) PinpointThreadFactory(com.navercorp.pinpoint.common.profiler.concurrent.PinpointThreadFactory)

Example 10 with PinpointThreadFactory

use of com.navercorp.pinpoint.common.profiler.concurrent.PinpointThreadFactory in project pinpoint by naver.

the class PinpointServerAcceptor method createBootStrap.

private ServerBootstrap createBootStrap(int bossCount, int workerCount) {
    // profiler, collector
    ExecutorService boss = Executors.newCachedThreadPool(new PinpointThreadFactory("Pinpoint-Server-Boss", true));
    NioServerBossPool nioServerBossPool = new NioServerBossPool(boss, bossCount, ThreadNameDeterminer.CURRENT);
    ExecutorService worker = Executors.newCachedThreadPool(new PinpointThreadFactory("Pinpoint-Server-Worker", true));
    NioWorkerPool nioWorkerPool = new NioWorkerPool(worker, workerCount, ThreadNameDeterminer.CURRENT);
    NioServerSocketChannelFactory nioClientSocketChannelFactory = new NioServerSocketChannelFactory(nioServerBossPool, nioWorkerPool);
    return new ServerBootstrap(nioClientSocketChannelFactory);
}
Also used : NioServerBossPool(org.jboss.netty.channel.socket.nio.NioServerBossPool) NioWorkerPool(org.jboss.netty.channel.socket.nio.NioWorkerPool) NioServerSocketChannelFactory(org.jboss.netty.channel.socket.nio.NioServerSocketChannelFactory) ExecutorService(java.util.concurrent.ExecutorService) ServerBootstrap(org.jboss.netty.bootstrap.ServerBootstrap) PinpointThreadFactory(com.navercorp.pinpoint.common.profiler.concurrent.PinpointThreadFactory)

Aggregations

PinpointThreadFactory (com.navercorp.pinpoint.common.profiler.concurrent.PinpointThreadFactory)10 ThreadFactory (java.util.concurrent.ThreadFactory)4 ScheduledThreadPoolExecutor (java.util.concurrent.ScheduledThreadPoolExecutor)2 DefaultApplicationContext (com.navercorp.pinpoint.profiler.context.module.DefaultApplicationContext)1 ShutdownHookRegisterProvider (com.navercorp.pinpoint.profiler.context.provider.ShutdownHookRegisterProvider)1 SimpleOrderedThreadPool (com.navercorp.pinpoint.web.util.SimpleOrderedThreadPool)1 CountDownLatch (java.util.concurrent.CountDownLatch)1 ExecutorService (java.util.concurrent.ExecutorService)1 LinkedBlockingQueue (java.util.concurrent.LinkedBlockingQueue)1 ScheduledExecutorService (java.util.concurrent.ScheduledExecutorService)1 ThreadPoolExecutor (java.util.concurrent.ThreadPoolExecutor)1 Configuration (org.apache.hadoop.conf.Configuration)1 ServerBootstrap (org.jboss.netty.bootstrap.ServerBootstrap)1 NioServerBossPool (org.jboss.netty.channel.socket.nio.NioServerBossPool)1 NioServerSocketChannelFactory (org.jboss.netty.channel.socket.nio.NioServerSocketChannelFactory)1 NioWorkerPool (org.jboss.netty.channel.socket.nio.NioWorkerPool)1 Test (org.junit.Test)1