Search in sources :

Example 1 with MonitoredExecutorService

use of com.navercorp.pinpoint.collector.monitor.MonitoredExecutorService 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 MonitoredExecutorService

use of com.navercorp.pinpoint.collector.monitor.MonitoredExecutorService in project pinpoint by naver.

the class TCPReceiver method afterPropertiesSet.

public void afterPropertiesSet() {
    ExecutorService worker = ExecutorFactory.newFixedThreadPool(configuration.getTcpWorkerThread(), configuration.getTcpWorkerQueueSize(), tcpWorkerThreadFactory);
    if (configuration.isTcpWorkerMonitor()) {
        if (metricRegistry == null) {
            logger.warn("metricRegistry not autowired. Can't enable monitoring.");
            this.worker = worker;
        } else {
            this.worker = new MonitoredExecutorService(worker, metricRegistry, this.getClass().getSimpleName() + "-Worker");
        }
    } else {
        this.worker = worker;
    }
    if (clusterService != null && clusterService.isEnable()) {
        this.serverAcceptor.addStateChangeEventHandler(clusterService.getChannelStateChangeEventHandler());
    }
    for (ServerStateChangeEventHandler channelStateChangeEventHandler : this.channelStateChangeEventHandlers) {
        serverAcceptor.addStateChangeEventHandler(channelStateChangeEventHandler);
    }
    setL4TcpChannel(serverAcceptor, configuration.getL4IpList());
}
Also used : ServerStateChangeEventHandler(com.navercorp.pinpoint.rpc.server.handler.ServerStateChangeEventHandler) MonitoredExecutorService(com.navercorp.pinpoint.collector.monitor.MonitoredExecutorService) ExecutorService(java.util.concurrent.ExecutorService) MonitoredExecutorService(com.navercorp.pinpoint.collector.monitor.MonitoredExecutorService)

Aggregations

MonitoredExecutorService (com.navercorp.pinpoint.collector.monitor.MonitoredExecutorService)2 DatagramPacketFactory (com.navercorp.pinpoint.collector.util.DatagramPacketFactory)1 PinpointThreadFactory (com.navercorp.pinpoint.common.util.PinpointThreadFactory)1 ServerStateChangeEventHandler (com.navercorp.pinpoint.rpc.server.handler.ServerStateChangeEventHandler)1 ExecutorService (java.util.concurrent.ExecutorService)1