Search in sources :

Example 1 with Stat

use of org.apache.geode.internal.admin.Stat in project geode by apache.

the class StatisticResourceImpl method refresh.

// -------------------------------------------------------------------------
// Operations
// -------------------------------------------------------------------------
public void refresh() throws org.apache.geode.admin.AdminException {
    Stat[] stats = null;
    if (this.statResource != null) {
        stats = this.statResource.getStats();
    }
    if (stats == null || stats.length < 1) {
        throw new AdminException(LocalizedStrings.StatisticResourceImpl_FAILED_TO_REFRESH_STATISTICS_0_FOR_1.toLocalizedString(getType() + "-" + getName(), getOwner()));
    }
    if (this.statistics == null || this.statistics.length < 1) {
        // define new statistics instances...
        List statList = new ArrayList();
        for (int i = 0; i < stats.length; i++) {
            statList.add(createStatistic(stats[i]));
        }
        this.statistics = (Statistic[]) statList.toArray(new Statistic[0]);
    } else {
        // update the existing instances...
        for (int i = 0; i < stats.length; i++) {
            updateStatistic(stats[i]);
        }
    }
}
Also used : AdminException(org.apache.geode.admin.AdminException) Stat(org.apache.geode.internal.admin.Stat) Statistic(org.apache.geode.admin.Statistic) ArrayList(java.util.ArrayList) List(java.util.List) ArrayList(java.util.ArrayList)

Aggregations

ArrayList (java.util.ArrayList)1 List (java.util.List)1 AdminException (org.apache.geode.admin.AdminException)1 Statistic (org.apache.geode.admin.Statistic)1 Stat (org.apache.geode.internal.admin.Stat)1