use of com.wavefront.agent.histogram.accumulator.AccumulationTask 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);
}
Aggregations