Interface RunningTaskStatisticsCollector

    • Method Detail

      • startCollectingStatistics

        void startCollectingStatistics​(@NotNull
                                       @NotNull StatisticsCollectionStrategy strategy)
        Initializes the process of collecting statistics in Statistics object embedded in the task.
      • restartCollectingStatisticsFromZero

        void restartCollectingStatisticsFromZero()
        Re-initializes process of collecting statistics from zero values.
      • refreshThreadLocalStatistics

        void refreshThreadLocalStatistics()
        Refreshes thread-local statistics held in `task.statistics` from their respective thread-local stores. *Call from the thread that executes the task ONLY! Otherwise wrong data might be recorded.*
      • updateOperationStatsInTaskPrism

        void updateOperationStatsInTaskPrism​(boolean updateThreadLocalStatistics)
        Updates operational statistics in prism object, based on existing values in Statistics objects for the current task and its lightweight subtasks. If `updateThreadLocalStatistics` is true, also updates this task Statistics using thread-local collectors. (*MUST* be called from the correct thread!)
      • storeStatisticsIntoRepositoryIfTimePassed

        boolean storeStatisticsIntoRepositoryIfTimePassed​(Runnable additionalUpdater,
                                                          OperationResult result)
                                                   throws SchemaException,
                                                          ObjectNotFoundException
        Stores statistics from `task.prism` to the repository, if the specified time interval passed. The time interval is there to avoid excessive repository operations. (Writing a large task can take quite a long time.)
        Parameters:
        additionalUpdater - A code that is called to update the task with other related data, for example activity-related statistics. The code should add its changes in the form of task pending modifications that will be written by the main method afterwards.
        Returns:
        true if the time passed and the update was carried out
        Throws:
        SchemaException
        ObjectNotFoundException
      • incrementLegacyProgressAndStoreStatisticsIfTimePassed

        void incrementLegacyProgressAndStoreStatisticsIfTimePassed​(OperationResult result)
                                                            throws SchemaException,
                                                                   ObjectNotFoundException
        Convenience method: Increments the legacy progress. Updates the statistics all the way through and stores them to repo if the time interval came. Beware: 1. If structured progress is enabled, there is no point in increasing legacy progress. This method is to be used only for handlers other than AbstractTaskHandler. 2. Because this encompasses thread-local stats update, *CALL ONLY FROM THE THREAD EXECUTING THE TASK!*
        Throws:
        SchemaException
        ObjectNotFoundException
      • setStatisticsRepoStoreInterval

        void setStatisticsRepoStoreInterval​(long interval)
        Sets the interval for storing statistics into the repository.