org.apache.ignite.internal.processors.query.stat

## Class StatisticsProcessor

- java.lang.Object
- - org.apache.ignite.internal.processors.query.stat.StatisticsProcessor

    public class StatisticsProcessor
    extends Object

Process all tasks, related to statistics repository. Mostly - statistics collection, invalidation (due to configuration, topology or obsolescence issues) and loads. Input tasks should be scheduled throug management pool while gathering pool used to process heavy operations in parallel. Manage gathering pool and it's jobs. To guarantee gracefull shutdown: 1) Any job can be added into gatheringInProgress only in active state (check after adding) 2) State can be disactivated only after cancelling all jobs and getting busyLock block 3) Each job should do it's work in busyLock with periodically checking of it's cancellation status.

### Constructor Summary

Constructors
Constructor and Description
`StatisticsProcessor(IgniteStatisticsRepository repo, IgniteThreadPoolExecutor gatherPool, Supplier<Boolean> stopping, Function<Class<?>,IgniteLogger> logSupplier)` Constructor.

### Method Summary

All Methods Instance Methods Concrete Methods
`void` `start()` Start gathering.
`void` `stop()` Stop gathering.
`void` `updateLocalStatistics(LocalStatisticsGatheringContext ctx)` Update statistics for the given key to actual state.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Constructor Detail

#### StatisticsProcessor

    public StatisticsProcessor(IgniteStatisticsRepository repo,
                               IgniteThreadPoolExecutor gatherPool,
                               Supplier<Boolean> stopping,
                               Function<Class<?>,IgniteLogger> logSupplier)

Constructor.

Parameters:
  `repo` - IgniteStatisticsRepository.
  `gatherPool` - Thread pool to gather statistics in.
  `stopping` - External stopping state supplier.
  `logSupplier` - Log supplier function.

### Method Detail

#### updateLocalStatistics

    public void updateLocalStatistics(LocalStatisticsGatheringContext ctx)

Update statistics for the given key to actual state. If byObsolescence and tbl is not `null` - does not clear any other partitions. 1) Replace previous gathering context if exist and needed (replace byObsolescence gathering with new one or replace gathering with older configuration or topology version with new one). 2) If byObsolescence and no table awailable - clean obsolescence and partition statistics for the given key. 3) Submit tasks for each specified partition. 4) after last task finish gathering - it starts aggregation. 5) read all partitions & obsolescence from repo and if byObsolescence = `true` - remove unnecessary one and aggregate by specified list if byObsolescence = `false` - aggregate all presented in store (because it should contains only actual ones) 5) save aggregated local statistics

Parameters:
  `ctx` - Statistics Gathering context.

#### start

    public void start()

Start gathering.

#### stop

    public void stop()

Stop gathering.

${current.year} Copyright © Apache Software Foundation

Follow @ApacheIgnite

Ignite Database and Caching Platform | : ver. 2.15.0
Release Date | : April 25 2023