Search in sources :

Example 1 with PinpointThreadFactory

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

the class UDPReceiver method afterPropertiesSet.

public void afterPropertiesSet() {
    Assert.notNull(metricRegistry, "metricRegistry must not be null");
    Assert.notNull(packetHandlerFactory, "packetHandlerFactory must not be null");
    this.worker = createWorker(workerOption, receiverName + "-Worker");
    if (workerOption.isEnableCollectMetric()) {
        this.worker = new MonitoredExecutorService(worker, metricRegistry, receiverName + "-Worker");
    }
    final int packetPoolSize = getPacketPoolSize(workerOption);
    this.datagramPacketPool = new DefaultObjectPool<>(new DatagramPacketFactory(), packetPoolSize);
    this.io = (ThreadPoolExecutor) Executors.newCachedThreadPool(new PinpointThreadFactory(receiverName + "-Io", true));
}
Also used : MonitoredExecutorService(com.navercorp.pinpoint.collector.monitor.MonitoredExecutorService) DatagramPacketFactory(com.navercorp.pinpoint.collector.util.DatagramPacketFactory) PinpointThreadFactory(com.navercorp.pinpoint.common.util.PinpointThreadFactory)

Example 2 with PinpointThreadFactory

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

the class TestUDPReceiver method afterPropertiesSet.

public void afterPropertiesSet() {
    Assert.notNull(packetHandlerFactory, "packetHandlerFactory must not be null");
    final int packetPoolSize = getPacketPoolSize(workerThreadSize, workerThreadQueueSize);
    this.datagramPacketPool = new DefaultObjectPool<>(new DatagramPacketFactory(), packetPoolSize);
    this.worker = ExecutorFactory.newFixedThreadPool(workerThreadSize, workerThreadQueueSize, receiverName + "-Worker", true);
    this.io = (ThreadPoolExecutor) Executors.newCachedThreadPool(new PinpointThreadFactory(receiverName + "-Io", true));
}
Also used : DatagramPacketFactory(com.navercorp.pinpoint.collector.util.DatagramPacketFactory) PinpointThreadFactory(com.navercorp.pinpoint.common.util.PinpointThreadFactory)

Example 3 with PinpointThreadFactory

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

the class StandbySpanStreamDataSendWorker method start.

public void start() {
    final ThreadFactory threadFactory = new PinpointThreadFactory(this.getClass().getSimpleName(), true);
    this.workerThread = threadFactory.newThread(this);
    logger.info("start() started.");
    if (!workerThread.isAlive()) {
        this.isStarted = true;
        this.workerThread.start();
        logger.info("start() completed.");
    } else {
        logger.info("start() failed. caused:already started.", this.getClass().getSimpleName());
    }
}
Also used : PinpointThreadFactory(com.navercorp.pinpoint.common.util.PinpointThreadFactory) ThreadFactory(java.util.concurrent.ThreadFactory) PinpointThreadFactory(com.navercorp.pinpoint.common.util.PinpointThreadFactory)

Example 4 with PinpointThreadFactory

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

the class BufferedUdpDataSender method startScheduledFlush.

private Thread startScheduledFlush() {
    final ThreadFactory threadFactory = new PinpointThreadFactory(SCHEDULED_FLUSH, true);
    final Thread thread = threadFactory.newThread(new Runnable() {

        @Override
        public void run() {
            final Thread currentThread = Thread.currentThread();
            while (!currentThread.isInterrupted()) {
                try {
                    chunkHeaderBufferedSerializer.flush();
                } catch (TException e) {
                    logger.warn("Failed to flush. caused={}", e.getMessage(), e);
                }
                try {
                    TimeUnit.MILLISECONDS.sleep(1000);
                } catch (InterruptedException ignored) {
                    currentThread.interrupt();
                }
            }
            logger.info("stop ScheduledFlush {} - {}", currentThread.getName(), currentThread.getId());
        }
    });
    logger.info("stop ScheduledFlush {} - {}", thread.getName(), thread.getId());
    thread.start();
    return thread;
}
Also used : TException(org.apache.thrift.TException) PinpointThreadFactory(com.navercorp.pinpoint.common.util.PinpointThreadFactory) ThreadFactory(java.util.concurrent.ThreadFactory) PinpointThreadFactory(com.navercorp.pinpoint.common.util.PinpointThreadFactory)

Example 5 with PinpointThreadFactory

use of com.navercorp.pinpoint.common.util.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(Runtime.getRuntime().availableProcessors(), 65535, flushThreadFactory);
    flushTimer = new java.util.Timer(ClassUtils.simpleClassName(this) + "-Flush-Timer", true);
    healthCheckTimer = new java.util.Timer(ClassUtils.simpleClassName(this) + "-HealthCheck-Timer", true);
    reactiveTimer = new java.util.Timer(ClassUtils.simpleClassName(this) + "-Reactive-Timer", true);
}
Also used : SimpleOrderedThreadPool(com.navercorp.pinpoint.web.util.SimpleOrderedThreadPool) PinpointThreadFactory(com.navercorp.pinpoint.common.util.PinpointThreadFactory)

Aggregations

PinpointThreadFactory (com.navercorp.pinpoint.common.util.PinpointThreadFactory)13 ThreadFactory (java.util.concurrent.ThreadFactory)4 DatagramPacketFactory (com.navercorp.pinpoint.collector.util.DatagramPacketFactory)2 ExecutorService (java.util.concurrent.ExecutorService)2 NioWorkerPool (org.jboss.netty.channel.socket.nio.NioWorkerPool)2 Test (org.junit.Test)2 MonitoredExecutorService (com.navercorp.pinpoint.collector.monitor.MonitoredExecutorService)1 SimpleOrderedThreadPool (com.navercorp.pinpoint.web.util.SimpleOrderedThreadPool)1 CountDownLatch (java.util.concurrent.CountDownLatch)1 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)1 Configuration (org.apache.hadoop.conf.Configuration)1 TException (org.apache.thrift.TException)1 ServerBootstrap (org.jboss.netty.bootstrap.ServerBootstrap)1 NioClientBossPool (org.jboss.netty.channel.socket.nio.NioClientBossPool)1 NioClientSocketChannelFactory (org.jboss.netty.channel.socket.nio.NioClientSocketChannelFactory)1 NioServerBossPool (org.jboss.netty.channel.socket.nio.NioServerBossPool)1 NioServerSocketChannelFactory (org.jboss.netty.channel.socket.nio.NioServerSocketChannelFactory)1