Class 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.
    • 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.