Search in sources :

Example 1 with MetricsCompressor

use of com.hazelcast.internal.metrics.impl.MetricsCompressor in project hazelcast by hazelcast.

the class JobMetricsPublisher method whenComplete.

@Override
public void whenComplete() {
    Set<Map.Entry<Long, MetricsCompressor>> compressorEntries = executionIdToCompressor.entrySet();
    for (Iterator<Map.Entry<Long, MetricsCompressor>> it = compressorEntries.iterator(); it.hasNext(); ) {
        Map.Entry<Long, MetricsCompressor> entry = it.next();
        MetricsCompressor compressor = entry.getValue();
        // remove compressors that didn't receive any metrics
        if (compressor.count() == 0) {
            it.remove();
        }
        Long executionId = entry.getKey();
        byte[] blob = compressor.getBlobAndReset();
        jobExecutionService.updateMetrics(executionId, RawJobMetrics.of(blob));
    }
}
Also used : MetricsCompressor(com.hazelcast.internal.metrics.impl.MetricsCompressor) HashMap(java.util.HashMap) Map(java.util.Map)

Aggregations

MetricsCompressor (com.hazelcast.internal.metrics.impl.MetricsCompressor)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1