Search in sources :

Example 1 with ImplementationException

use of mx4j.ImplementationException in project geode by apache.

the class MX4JModelMBean method shouldPersistNow.

private boolean shouldPersistNow(Descriptor attribute, Descriptor mbean, String lastUpdateField) {
    int persist = getPersistPolicy(attribute, mbean);
    if (persist == PERSIST_NO_MORE_OFTEN_THAN) {
        Long period = getFieldTimeValue(attribute, mbean, "persistPeriod");
        long now = System.currentTimeMillis();
        Long lastUpdate = (Long) attribute.getFieldValue(lastUpdateField);
        if (now - lastUpdate.longValue() < period.longValue())
            return false;
        else
            return true;
    } else if (persist == PERSIST_NEVER) {
        return false;
    } else if (persist == PERSIST_ON_TIMER) {
        return false;
    } else if (persist == PERSIST_ON_UPDATE) {
        return true;
    } else {
        throw new ImplementationException(LocalizedStrings.MX4JModelMBean_INVALID_PERSIST_VALUE.toLocalizedString());
    }
}
Also used : ImplementationException(mx4j.ImplementationException)

Aggregations

ImplementationException (mx4j.ImplementationException)1