org.olat.course.statistic
Interface StatisticUpdateManager


public interface StatisticUpdateManager

The StatisticUpdateManager is a pod for registering all IStatisticUpdaters and all it does is going through each of the IStatisticUpdaters to call its updateStatistic method.

Initial Date: 11.02.2010

Author:
Stefan

Method Summary
 void addStatisticUpdater(IStatisticUpdater updater)
          Add the given IStatisticUpdater to this StatisticUpdateManager.
 long getAndUpdateLastUpdated(long lastUpdated)
          Sets the LAST_UPDATED property to the given value lastUpdated
 long getLastUpdated()
          Returns the existing LAST_UPDATED property's value - or -1 if it's not set
 boolean isEnabled()
          Returns whether this manager is enabled or not.
 boolean updateOngoing()
          Checks whether in this very moment an update is ongoing.
 boolean updateStatistics(boolean fullRecalculation, java.lang.Runnable finishedCallback)
          Update all statistics - that is, all that registered itself via addStatisticUpdater
 

Method Detail

addStatisticUpdater

void addStatisticUpdater(IStatisticUpdater updater)
Add the given IStatisticUpdater to this StatisticUpdateManager.

Note that is the duty of the IStatisticUpdater to register itself with this StatisticUpdateManager!

Parameters:
updater - the updater to be added to this StatisticUpdateManager

getAndUpdateLastUpdated

long getAndUpdateLastUpdated(long lastUpdated)
Sets the LAST_UPDATED property to the given value lastUpdated

Parameters:
lastUpdated - the new lastUpdated value

getLastUpdated

long getLastUpdated()
Returns the existing LAST_UPDATED property's value - or -1 if it's not set

Returns:
the existing LAST_UPDATED property's value - or -1 if it's not set

updateStatistics

boolean updateStatistics(boolean fullRecalculation,
                         java.lang.Runnable finishedCallback)
Update all statistics - that is, all that registered itself via addStatisticUpdater

Returns:
whether or not the update could be started (returns false when this manager is not enabled or when an update is already ongoing)

isEnabled

boolean isEnabled()
Returns whether this manager is enabled or not. It will be enabled on one node in a cluster only

Returns:
whether this manager is enabled or not. It will be enabled on one node in a cluster only

updateOngoing

boolean updateOngoing()
Checks whether in this very moment an update is ongoing.

Note that one millisecond later, some other node or the cron might start an update - so this is really just true for this very moment

Returns:
whether in this very moment an update is ongoing