Search in sources :

Example 1 with PERFORMANCE_STATISTICS_ROTATE

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) -> {
    });
}
Also used : ReadableDistributedMetaStorage(org.apache.ignite.internal.processors.metastorage.ReadableDistributedMetaStorage) IGNITE_INTERNAL_KEY_PREFIX(org.apache.ignite.internal.processors.metastorage.DistributedMetaStorage.IGNITE_INTERNAL_KEY_PREFIX) NodeStoppingException(org.apache.ignite.internal.NodeStoppingException) PERFORMANCE_STATISTICS_ROTATE(org.apache.ignite.internal.util.distributed.DistributedProcess.DistributedProcessType.PERFORMANCE_STATISTICS_ROTATE) DistributedMetastorageLifecycleListener(org.apache.ignite.internal.processors.metastorage.DistributedMetastorageLifecycleListener) DistributedMetaStorage(org.apache.ignite.internal.processors.metastorage.DistributedMetaStorage) U(org.apache.ignite.internal.util.typedef.internal.U) IgniteFeatures(org.apache.ignite.internal.IgniteFeatures) ArrayList(java.util.ArrayList) GridKernalContext(org.apache.ignite.internal.GridKernalContext) DistributedProcess(org.apache.ignite.internal.util.distributed.DistributedProcess) IgniteFuture(org.apache.ignite.lang.IgniteFuture) GridIntList(org.apache.ignite.internal.util.GridIntList) A(org.apache.ignite.internal.util.typedef.internal.A) IgniteFeatures.allNodesSupports(org.apache.ignite.internal.IgniteFeatures.allNodesSupports) IgniteCheckedException(org.apache.ignite.IgniteCheckedException) IgniteException(org.apache.ignite.IgniteException) UUID(java.util.UUID) Serializable(java.io.Serializable) Consumer(java.util.function.Consumer) EventListener(java.util.EventListener) Nullable(org.jetbrains.annotations.Nullable) GridCacheQueryType(org.apache.ignite.internal.processors.cache.query.GridCacheQueryType) ReadableDistributedMetaStorage(org.apache.ignite.internal.processors.metastorage.ReadableDistributedMetaStorage) GridPlainRunnable(org.apache.ignite.internal.util.lang.GridPlainRunnable) GridProcessorAdapter(org.apache.ignite.internal.processors.GridProcessorAdapter) IgniteUuid(org.apache.ignite.lang.IgniteUuid) DistributedMetaStorage(org.apache.ignite.internal.processors.metastorage.DistributedMetaStorage) ReadableDistributedMetaStorage(org.apache.ignite.internal.processors.metastorage.ReadableDistributedMetaStorage) IgniteCheckedException(org.apache.ignite.IgniteCheckedException) IgniteException(org.apache.ignite.IgniteException) DistributedMetastorageLifecycleListener(org.apache.ignite.internal.processors.metastorage.DistributedMetastorageLifecycleListener)

Aggregations

Serializable (java.io.Serializable)1 ArrayList (java.util.ArrayList)1 EventListener (java.util.EventListener)1 UUID (java.util.UUID)1 Consumer (java.util.function.Consumer)1 IgniteCheckedException (org.apache.ignite.IgniteCheckedException)1 IgniteException (org.apache.ignite.IgniteException)1 GridKernalContext (org.apache.ignite.internal.GridKernalContext)1 IgniteFeatures (org.apache.ignite.internal.IgniteFeatures)1 IgniteFeatures.allNodesSupports (org.apache.ignite.internal.IgniteFeatures.allNodesSupports)1 NodeStoppingException (org.apache.ignite.internal.NodeStoppingException)1 GridProcessorAdapter (org.apache.ignite.internal.processors.GridProcessorAdapter)1 GridCacheQueryType (org.apache.ignite.internal.processors.cache.query.GridCacheQueryType)1 DistributedMetaStorage (org.apache.ignite.internal.processors.metastorage.DistributedMetaStorage)1 IGNITE_INTERNAL_KEY_PREFIX (org.apache.ignite.internal.processors.metastorage.DistributedMetaStorage.IGNITE_INTERNAL_KEY_PREFIX)1 DistributedMetastorageLifecycleListener (org.apache.ignite.internal.processors.metastorage.DistributedMetastorageLifecycleListener)1 ReadableDistributedMetaStorage (org.apache.ignite.internal.processors.metastorage.ReadableDistributedMetaStorage)1 GridIntList (org.apache.ignite.internal.util.GridIntList)1 DistributedProcess (org.apache.ignite.internal.util.distributed.DistributedProcess)1 PERFORMANCE_STATISTICS_ROTATE (org.apache.ignite.internal.util.distributed.DistributedProcess.DistributedProcessType.PERFORMANCE_STATISTICS_ROTATE)1