use of org.apache.ignite.internal.util.distributed.DistributedProcess.DistributedProcessType.PERFORMANCE_STATISTICS_ROTATE in project ignite by apache.
the class PerformanceStatisticsProcessor method start.
/**
* {@inheritDoc}
*/
@Override
public void start() throws IgniteCheckedException {
super.start();
ctx.internalSubscriptionProcessor().registerDistributedMetastorageListener(new DistributedMetastorageLifecycleListener() {
@Override
public void onReadyForRead(ReadableDistributedMetaStorage metastorage) {
metastorage.listen(PERF_STAT_KEY::equals, (key, oldVal, newVal) -> {
// Skip history on local join.
if (!ctx.discovery().localJoinFuture().isDone())
return;
onMetastorageUpdate((boolean) newVal);
});
}
@Override
public void onReadyForWrite(DistributedMetaStorage metastorage) {
PerformanceStatisticsProcessor.this.metastorage = metastorage;
try {
Boolean performanceStatsEnabled = metastorage.read(PERF_STAT_KEY);
if (performanceStatsEnabled == null)
return;
onMetastorageUpdate(performanceStatsEnabled);
} catch (IgniteCheckedException e) {
throw new IgniteException(e);
}
}
});
rotateProc = new DistributedProcess<>(ctx, PERFORMANCE_STATISTICS_ROTATE, req -> ctx.closure().callLocalSafe(() -> {
rotateWriter();
return null;
}), (id, res, err) -> {
});
}
Aggregations