private boolean incrementEvictionCounter() { evictionCount++; boolean isTimeForOrphanEviction = evictionCount >= config.getOrphanEvictionPeriod(); if (isTimeForOrphanEviction) { evictionCount = 0; } return isTimeForOrphanEviction; }
private boolean incrementEvictionCounter() { evictionCount++; boolean isTimeForOrphanEviction = evictionCount >= config.getOrphanEvictionPeriod(); if (isTimeForOrphanEviction) { evictionCount = 0; } return isTimeForOrphanEviction; }
private boolean incrementEvictionCounter() { evictionCount++; boolean isTimeForOrphanEviction = evictionCount >= config.getOrphanEvictionPeriod(); if (isTimeForOrphanEviction) { evictionCount = 0; } return isTimeForOrphanEviction; }
private boolean incrementEvictionCounter() { evictionCount++; boolean isTimeForOrphanEviction = evictionCount >= config.getOrphanEvictionPeriod(); if (isTimeForOrphanEviction) { evictionCount = 0; } return isTimeForOrphanEviction; }
public int getOrphanEvictionPeriod() { return snapshot.getOrphanEvictionPeriod(); }
public int getOrphanEvictionPeriod() { return snapshot.getOrphanEvictionPeriod(); }
public int getOrphanEvictionPeriod() { return snapshot.getOrphanEvictionPeriod(); }
public int getRegionCacheOrphanEvictionPeriod(final String region) { return lookupTerracottaHibernateEvictorConfig(region).getOrphanEvictionPeriod(); }
/** * Construct an orphan eviction listener with clustered state * * @param config The clustered configuration of the orphan distributed map and orphan evictor * @param store The clustered store to evict * @param orphanEvictorLock The clustered lock that is used as a token to indicate the elected orphan evictor */ public OrphanEvictionListener(CacheConfig config, Evictable<K> store, EvictorLock orphanEvictorLock) { // Copy configuration this.config = config; if (config.isOrphanEvictionEnabled()) { Assert.eval(config.getOrphanEvictionPeriod() > 0); } // Copy clustered resources this.store = store; this.orphanEvictorLock = orphanEvictorLock; }
/** * Construct an orphan eviction listener with clustered state * * @param config The clustered configuration of the orphan distributed map and orphan evictor * @param store The clustered store to evict * @param orphanEvictorLock The clustered lock that is used as a token to indicate the elected orphan evictor */ public OrphanEvictionListener(CacheConfig config, Evictable<K> store, EvictorLock orphanEvictorLock) { // Copy configuration this.config = config; if (config.isOrphanEvictionEnabled()) { Assert.eval(config.getOrphanEvictionPeriod() > 0); } // Copy clustered resources this.store = store; this.orphanEvictorLock = orphanEvictorLock; }
/** * Construct an orphan eviction listener with clustered state * * @param config The clustered configuration of the orphan distributed map and orphan evictor * @param store The clustered store to evict * @param orphanEvictorLock The clustered lock that is used as a token to indicate the elected orphan evictor */ public OrphanEvictionListener(CacheConfig config, Evictable<K> store, EvictorLock orphanEvictorLock) { // Copy configuration this.config = config; if (config.isOrphanEvictionEnabled()) { Assert.eval(config.getOrphanEvictionPeriod() > 0); } // Copy clustered resources this.store = store; this.orphanEvictorLock = orphanEvictorLock; }
/** * Construct an orphan eviction listener with clustered state * * @param config The clustered configuration of the orphan distributed map and orphan evictor * @param store The clustered store to evict * @param orphanEvictorLock The clustered lock that is used as a token to indicate the elected orphan evictor */ public OrphanEvictionListener(CacheConfig config, Evictable<K> store, EvictorLock orphanEvictorLock) { // Copy configuration this.config = config; if (config.isOrphanEvictionEnabled()) { Assert.eval(config.getOrphanEvictionPeriod() > 0); } // Copy clustered resources this.store = store; this.orphanEvictorLock = orphanEvictorLock; }
/** * Perform orphan eviction */ public void endLocalEviction() { log("Local eviction finished"); if (!config.isOrphanEvictionEnabled() || !isOrphanEvictor || !(config.getMaxTTISeconds() > 0 || config.getMaxTTLSeconds() > 0)) { return; } boolean isTimeForOrphanEviction = incrementEvictionCounter(); if (isTimeForOrphanEviction) { log("Running orphan eviction (evictionCount = " + evictionCount + ", orphanEvictionPeriod = " + config.getOrphanEvictionPeriod() + ")"); // when the cluster information has been injected, there's also no sense to evict if (clusterInfo != null) { store.evictOrphanElements(clusterInfo); } } else { log("Not running orphan eviction (evictionCount = " + evictionCount + ", orphanEvictionPeriod = " + config.getOrphanEvictionPeriod() + ")"); } }
/** * Perform orphan eviction */ public void endLocalEviction() { log("Local eviction finished"); if (!config.isOrphanEvictionEnabled() || !isOrphanEvictor || !(config.getMaxTTISeconds() > 0 || config.getMaxTTLSeconds() > 0)) { return; } boolean isTimeForOrphanEviction = incrementEvictionCounter(); if (isTimeForOrphanEviction) { log("Running orphan eviction (evictionCount = " + evictionCount + ", orphanEvictionPeriod = " + config.getOrphanEvictionPeriod() + ")"); // when the cluster information has been injected, there's also no sense to evict ClusterInfo clusterInfo = new TerracottaClusterInfo(); if (clusterInfo.isClusterInitialized()) { store.evictOrphanElements(clusterInfo); } } else { log("Not running orphan eviction (evictionCount = " + evictionCount + ", orphanEvictionPeriod = " + config.getOrphanEvictionPeriod() + ")"); } }
/** * Perform orphan eviction */ public void endLocalEviction() { log("Local eviction finished"); if (!config.isOrphanEvictionEnabled() || !isOrphanEvictor || !(config.getMaxTTISeconds() > 0 || config.getMaxTTLSeconds() > 0)) { return; } boolean isTimeForOrphanEviction = incrementEvictionCounter(); if (isTimeForOrphanEviction) { log("Running orphan eviction (evictionCount = " + evictionCount + ", orphanEvictionPeriod = " + config.getOrphanEvictionPeriod() + ")"); // when the cluster information has been injected, there's also no sense to evict ClusterInfo clusterInfo = new TerracottaClusterInfo(); if (clusterInfo.isClusterInitialized()) { store.evictOrphanElements(clusterInfo); } } else { log("Not running orphan eviction (evictionCount = " + evictionCount + ", orphanEvictionPeriod = " + config.getOrphanEvictionPeriod() + ")"); } }
/** * Perform orphan eviction */ public void endLocalEviction() { log("Local eviction finished"); if (!config.isOrphanEvictionEnabled() || !isOrphanEvictor || !(config.getMaxTTISeconds() > 0 || config.getMaxTTLSeconds() > 0)) { return; } boolean isTimeForOrphanEviction = incrementEvictionCounter(); if (isTimeForOrphanEviction) { log("Running orphan eviction (evictionCount = " + evictionCount + ", orphanEvictionPeriod = " + config.getOrphanEvictionPeriod() + ")"); // when the cluster information has been injected, there's also no sense to evict ClusterInfo clusterInfo = new TerracottaClusterInfo(); if (clusterInfo.isClusterInitialized()) { store.evictOrphanElements(clusterInfo); } } else { log("Not running orphan eviction (evictionCount = " + evictionCount + ", orphanEvictionPeriod = " + config.getOrphanEvictionPeriod() + ")"); } }
public ImmutableConfig(CacheConfig config) { this.name = config.getName(); this.loggingEnabled = config.isLoggingEnabled(); this.maxTTISeconds = config.getMaxTTISeconds(); this.maxTTLSeconds = config.getMaxTTLSeconds(); this.orphanEvictionEnabled = config.isOrphanEvictionEnabled(); this.orphanEvictionPeriod = config.getOrphanEvictionPeriod(); this.targetMaxInMemoryCount = config.getTargetMaxInMemoryCount(); this.targetMaxTotalCount = config.getTargetMaxTotalCount(); this.capacityEvictionPolicyDataFactory = config.getCapacityEvictionPolicyDataFactory(); }
/** * Constructs an immutable configuration as a value-based copy of the supplied configuration. * * @param config configuration to copy from */ public ImmutableConfig(final CacheConfig config) { this.name = config.getName(); this.loggingEnabled = config.isLoggingEnabled(); this.maxTTISeconds = config.getMaxTTISeconds(); this.maxTTLSeconds = config.getMaxTTLSeconds(); this.orphanEvictionEnabled = config.isOrphanEvictionEnabled(); this.orphanEvictionPeriod = config.getOrphanEvictionPeriod(); this.targetMaxInMemoryCount = config.getTargetMaxInMemoryCount(); this.targetMaxTotalCount = config.getTargetMaxTotalCount(); this.capacityEvictionPolicyDataFactory = config.getCapacityEvictionPolicyDataFactory(); this.serverMap = config.isServerMap(); }
/** * Constructs an immutable configuration as a value-based copy of the supplied * configuration. * * @param config configuration to copy from */ public ImmutableConfig(final CacheConfig config) { this.name = config.getName(); this.loggingEnabled = config.isLoggingEnabled(); this.maxTTISeconds = config.getMaxTTISeconds(); this.maxTTLSeconds = config.getMaxTTLSeconds(); this.orphanEvictionEnabled = config.isOrphanEvictionEnabled(); this.orphanEvictionPeriod = config.getOrphanEvictionPeriod(); this.targetMaxInMemoryCount = config.getTargetMaxInMemoryCount(); this.targetMaxTotalCount = config.getTargetMaxTotalCount(); this.capacityEvictionPolicyDataFactory = config.getCapacityEvictionPolicyDataFactory(); this.serverMap = config.isServerMap(); }
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); } }