Search in sources :

Example 1 with QueuingChannelHandler

use of com.wavefront.agent.histogram.QueuingChannelHandler in project java by wavefrontHQ.

the class PushAgent method startHistogramListener.

/**
 * Needs to set up a queueing handler and a consumer/lexer for the queue
 */
private void startHistogramListener(String portAsString, Decoder<String> decoder, PointHandler handler, AccumulationCache accumulationCache, File directory, Utils.Granularity granularity, TapeDeck<List<String>> receiveDeck, long timeToLiveMillis, int fanout, short compression) {
    int port = Integer.parseInt(portAsString);
    List<ChannelHandler> handlers = new ArrayList<>();
    for (int i = 0; i < fanout; ++i) {
        File tapeFile = new File(directory, "Port_" + portAsString + "_" + i);
        ObjectQueue<List<String>> receiveTape = receiveDeck.getTape(tapeFile);
        // Set-up scanner
        AccumulationTask scanTask = new AccumulationTask(receiveTape, accumulationCache, decoder, handler, Validation.Level.valueOf(pushValidationLevel), timeToLiveMillis, granularity, compression);
        histogramScanExecutor.scheduleWithFixedDelay(scanTask, histogramProcessingQueueScanInterval, histogramProcessingQueueScanInterval, TimeUnit.MILLISECONDS);
        QueuingChannelHandler<String> inputHandler = new QueuingChannelHandler<>(receiveTape, pushFlushMaxPoints.get(), histogramDisabled);
        handlers.add(inputHandler);
        histogramFlushExecutor.scheduleWithFixedDelay(inputHandler.getBufferFlushTask(), histogramReceiveBufferFlushInterval, histogramReceiveBufferFlushInterval, TimeUnit.MILLISECONDS);
    }
    // Set-up producer
    startAsManagedThread(new HistogramLineIngester(handlers, port), "listener-plaintext-histogram-" + port);
}
Also used : HistogramLineIngester(com.wavefront.agent.histogram.HistogramLineIngester) ArrayList(java.util.ArrayList) AccumulationTask(com.wavefront.agent.histogram.accumulator.AccumulationTask) List(java.util.List) ArrayList(java.util.ArrayList) QueuingChannelHandler(com.wavefront.agent.histogram.QueuingChannelHandler) ChannelHandler(io.netty.channel.ChannelHandler) QueuingChannelHandler(com.wavefront.agent.histogram.QueuingChannelHandler) File(java.io.File)

Aggregations

HistogramLineIngester (com.wavefront.agent.histogram.HistogramLineIngester)1 QueuingChannelHandler (com.wavefront.agent.histogram.QueuingChannelHandler)1 AccumulationTask (com.wavefront.agent.histogram.accumulator.AccumulationTask)1 ChannelHandler (io.netty.channel.ChannelHandler)1 File (java.io.File)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1