use of gnu.trove.map.TObjectLongMap in project spf4j by zolyfarkas.
the class GCUsageSampler method start.
@JmxExport
public static synchronized void start(@JmxExport("sampleTimeMillis") final int sampleTime) {
if (samplingFuture == null) {
final MeasurementRecorder gcUsage = RecorderFactory.createDirectRecorder("gc-time", "ms", sampleTime);
samplingFuture = DefaultScheduler.INSTANCE.scheduleWithFixedDelay(new AbstractRunnable() {
private final TObjectLongMap lastValues = new TObjectLongHashMap();
@Override
public void doRun() {
synchronized (lastValues) {
gcUsage.record(getGCTimeDiff(MBEANS, lastValues));
}
}
}, sampleTime, sampleTime, TimeUnit.MILLISECONDS);
} else {
throw new IllegalStateException("GC usage sampling already started " + samplingFuture);
}
}
Aggregations