Search in sources :

Example 6 with CustomExpiry

use of org.apache.geode.cache.CustomExpiry in project geode by apache.

the class AbstractRegion method setCustomEntryIdleTimeout.

@Override
public CustomExpiry setCustomEntryIdleTimeout(CustomExpiry custom) {
    checkReadiness();
    if (custom != null && !this.statisticsEnabled) {
        throw new IllegalStateException(LocalizedStrings.AbstractRegion_CANNOT_SET_IDLE_TIMEOUT_WHEN_STATISTICS_ARE_DISABLED.toLocalizedString());
    }
    CustomExpiry old = getCustomEntryIdleTimeout();
    this.customEntryIdleTimeout = custom;
    updateEntryExpiryPossible();
    idleTimeoutChanged(getEntryIdleTimeout());
    return old;
}
Also used : CustomExpiry(org.apache.geode.cache.CustomExpiry)

Example 7 with CustomExpiry

use of org.apache.geode.cache.CustomExpiry in project geode by apache.

the class PartitionedRegion method setCustomEntryTimeToLive.

/**
   * Changes the custom timeToLive for values in this region
   * 
   * @param custom the new CustomExpiry
   * @return the old CustomExpiry
   */
@Override
public CustomExpiry setCustomEntryTimeToLive(CustomExpiry custom) {
    CustomExpiry expiry = super.setCustomEntryTimeToLive(custom);
    // Set to Bucket regions as well
    if (this.getDataStore() != null) {
        // not for accessors
        for (Object o : this.getDataStore().getAllLocalBuckets()) {
            Map.Entry entry = (Map.Entry) o;
            Region bucketRegion = (Region) entry.getValue();
            bucketRegion.getAttributesMutator().setCustomEntryTimeToLive(custom);
        }
    }
    return expiry;
}
Also used : Region(org.apache.geode.cache.Region) DumpB2NRegion(org.apache.geode.internal.cache.partitioned.DumpB2NRegion) Map(java.util.Map) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) ConcurrentMap(java.util.concurrent.ConcurrentMap) HashMap(java.util.HashMap) CustomExpiry(org.apache.geode.cache.CustomExpiry)

Aggregations

CustomExpiry (org.apache.geode.cache.CustomExpiry)7 HashMap (java.util.HashMap)2 Map (java.util.Map)2 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)2 ConcurrentMap (java.util.concurrent.ConcurrentMap)2 Region (org.apache.geode.cache.Region)2 DumpB2NRegion (org.apache.geode.internal.cache.partitioned.DumpB2NRegion)2 CacheXmlException (org.apache.geode.cache.CacheXmlException)1 Declarable (org.apache.geode.cache.Declarable)1