public boolean refresh() { // read <autolock>'d synchronized (this) { CacheConfig oldSnapshot = snapshot; // don't use the ImmutableConfig(Config) constructor; it would read the snapshot... snapshot = new ImmutableConfig(name, loggingEnabled, maxTTISeconds, maxTTLSeconds, orphanEvictionEnabled, orphanEvictionPeriod, targetMaxInMemoryCount, targetMaxTotalCount, capacityEvictionPolicyDataFactory, serverMap); if (oldSnapshot != null) { fireChangeEventIfNeeded("name", oldSnapshot.getName(), name); fireChangeEventIfNeeded("loggingEnabled", oldSnapshot.isLoggingEnabled(), loggingEnabled); fireChangeEventIfNeeded("maxTTISeconds", oldSnapshot.getMaxTTISeconds(), maxTTISeconds); fireChangeEventIfNeeded("maxTTLSeconds", oldSnapshot.getMaxTTLSeconds(), maxTTLSeconds); fireChangeEventIfNeeded("orphanEvictionEnabled", oldSnapshot.isOrphanEvictionEnabled(), orphanEvictionEnabled); fireChangeEventIfNeeded("orphanEvictionPeriod", oldSnapshot.getOrphanEvictionPeriod(), orphanEvictionPeriod); fireChangeEventIfNeeded("targetMaxInMemoryCount", oldSnapshot.getTargetMaxInMemoryCount(), targetMaxInMemoryCount); fireChangeEventIfNeeded("targetMaxTotalCount", oldSnapshot.getTargetMaxTotalCount(), targetMaxTotalCount); fireChangeEventIfNeeded("capacityEvictionPolicyDataFactory", oldSnapshot.getCapacityEvictionPolicyDataFactory(), capacityEvictionPolicyDataFactory); } return !snapshot.equals(oldSnapshot); } }
public boolean refresh() { // read <autolock>'d synchronized (this) { CacheConfig oldSnapshot = snapshot; // don't use the ImmutableConfig(Config) constructor; it would read the snapshot... snapshot = new ImmutableConfig(name, loggingEnabled, maxTTISeconds, maxTTLSeconds, orphanEvictionEnabled, orphanEvictionPeriod, targetMaxInMemoryCount, targetMaxTotalCount, capacityEvictionPolicyDataFactory, serverMap); if (oldSnapshot != null) { fireChangeEventIfNeeded("name", oldSnapshot.getName(), name); fireChangeEventIfNeeded("loggingEnabled", oldSnapshot.isLoggingEnabled(), loggingEnabled); fireChangeEventIfNeeded("maxTTISeconds", oldSnapshot.getMaxTTISeconds(), maxTTISeconds); fireChangeEventIfNeeded("maxTTLSeconds", oldSnapshot.getMaxTTLSeconds(), maxTTLSeconds); fireChangeEventIfNeeded("orphanEvictionEnabled", oldSnapshot.isOrphanEvictionEnabled(), orphanEvictionEnabled); fireChangeEventIfNeeded("orphanEvictionPeriod", oldSnapshot.getOrphanEvictionPeriod(), orphanEvictionPeriod); fireChangeEventIfNeeded("targetMaxInMemoryCount", oldSnapshot.getTargetMaxInMemoryCount(), targetMaxInMemoryCount); fireChangeEventIfNeeded("targetMaxTotalCount", oldSnapshot.getTargetMaxTotalCount(), targetMaxTotalCount); fireChangeEventIfNeeded("capacityEvictionPolicyDataFactory", oldSnapshot.getCapacityEvictionPolicyDataFactory(), capacityEvictionPolicyDataFactory); } return !snapshot.equals(oldSnapshot); } }
public boolean refresh() { // read <autolock>'d synchronized (this) { ImmutableConfig oldSnapshot = snapshot; // don't use the ImmutableConfig(Config) constructor; it would read the snapshot... snapshot = new ImmutableConfig(name, loggingEnabled, maxTTISeconds, maxTTLSeconds, orphanEvictionEnabled, orphanEvictionPeriod, targetMaxInMemoryCount, targetMaxTotalCount, capacityEvictionPolicyDataFactory, serverMap, localCacheEnabled); if (oldSnapshot != null) { fireChangeEventIfNeeded(NAME, oldSnapshot.getName(), name); fireChangeEventIfNeeded(LOGGING_ENABLED, oldSnapshot.isLoggingEnabled(), loggingEnabled); fireChangeEventIfNeeded(MAX_TTI_SECONDS, oldSnapshot.getMaxTTISeconds(), maxTTISeconds); fireChangeEventIfNeeded(MAX_TTL_SECONDS, oldSnapshot.getMaxTTLSeconds(), maxTTLSeconds); fireChangeEventIfNeeded(ORPHAN_EVICTION_ENABLED, oldSnapshot.isOrphanEvictionEnabled(), orphanEvictionEnabled); fireChangeEventIfNeeded(ORPHAN_EVICTION_PERIOD, oldSnapshot.getOrphanEvictionPeriod(), orphanEvictionPeriod); fireChangeEventIfNeeded(TARGET_MAX_ENTRIES_LOCAL_HEAP, oldSnapshot.getTargetMaxInMemoryCount(), targetMaxInMemoryCount); fireChangeEventIfNeeded(TARGET_MAX_TOTAL_COUNT, oldSnapshot.getTargetMaxTotalCount(), targetMaxTotalCount); fireChangeEventIfNeeded(CAPACITY_EVICTION_POLICY_DATA_FACTORY, oldSnapshot.getCapacityEvictionPolicyDataFactory(), capacityEvictionPolicyDataFactory); fireChangeEventIfNeeded(LOCAL_CACHE_ENABLED, oldSnapshot.isLocalCacheEnabled(), localCacheEnabled); } return !snapshot.equals(oldSnapshot); } }