• Bug
  • Status: Open
  • 2 Major
  • Resolution:
  • ehcache-core
  • interfaces
  • Reporter: latchkey
  • November 09, 2009
  • 0
  • Watchers: 0
  • December 16, 2011

Description

This should be an enum….

/**
 * Fast but not accurate setting.
 */
public static final int STATISTICS_ACCURACY_NONE = 0;

/**
 * Best efforts accuracy setting.
 */
public static final int STATISTICS_ACCURACY_BEST_EFFORT = 1;

/**
 * Guaranteed accuracy setting.
 */
public static final int STATISTICS_ACCURACY_GUARANTEED = 2;

public String getStatisticsAccuracyDescription() {
    if (statisticsAccuracy == 0) {
        return "None";
    } else if (statisticsAccuracy == 1) {
        return "Best Effort";
    } else {
        return "Guaranteed";
    }
}

That method should refer to the enum’s instead of doing integer comparisons.

Comments

Alex Miller 2009-11-10

These constants pre-date the move to support only JDK 1.5+ (as of Ehcache 1.6.0). They will probably not be converted to an enum as that would be a breaking change. At some future point we may make a release that fixes a number of API issues like this.

Jon Stevens 2009-11-10

Internally, getStatisticsAccuracyDescription should also use the statics.