use of org.apache.geode.cache.ExpirationAttributes in project geode by apache.
the class HARegionQueue method disableEntryExpiryTasks.
/**
* Disables EntryExpiryTask for the HARegion ({@code this.region}).
*
*/
private void disableEntryExpiryTasks() {
int oldTimeToLive = this.region.getEntryTimeToLive().getTimeout();
if (oldTimeToLive > 0) {
ExpirationAttributes ea = new // disables expiration
ExpirationAttributes(// disables expiration
0, ExpirationAction.LOCAL_INVALIDATE);
this.region.setEntryTimeToLive(ea);
this.region.setCustomEntryTimeToLive(new ThreadIdentifierCustomExpiry());
logger.info(LocalizedMessage.create(LocalizedStrings.HARegionQueue_ENYTRY_EXPIRY_TASKS_DISABLED_BECAUSE_QUEUE_BECAME_PRIMARY_OLD_MSG_TTL_0, new Object[] { oldTimeToLive }));
}
}
use of org.apache.geode.cache.ExpirationAttributes in project geode by apache.
the class CacheXmlParser method endRegionTimeToLive.
/**
* When a <code>region-time-to-live</code> element is finished, the {@link ExpirationAttributes}
* are on top of the stack followed by the {@link RegionAttributesCreation} to which the
* expiration attributes are assigned.
*/
private void endRegionTimeToLive() {
ExpirationAttributes expire = (ExpirationAttributes) stack.pop();
RegionAttributesCreation attrs = peekRegionAttributesContext("region-time-to-live");
attrs.setRegionTimeToLive(expire);
}
use of org.apache.geode.cache.ExpirationAttributes in project geode by apache.
the class CacheXmlParser method endRegionIdleTime.
/**
* When a <code>region-idle-time</code> element is finished, the {@link ExpirationAttributes} are
* on top of the stack followed by the {@link RegionAttributesCreation} to which the expiration
* attributes are assigned.
*/
private void endRegionIdleTime() {
ExpirationAttributes expire = (ExpirationAttributes) stack.pop();
RegionAttributesCreation attrs = peekRegionAttributesContext("region-idle-time");
attrs.setRegionIdleTimeout(expire);
}
use of org.apache.geode.cache.ExpirationAttributes in project geode by apache.
the class HARegion method setEntryTimeToLive.
/**
* Overriding this method so as to allow expiry action of local invalidate even if the scope is
* distributed mirrored.
*
* <p>
* author Asif
*/
@Override
public ExpirationAttributes setEntryTimeToLive(ExpirationAttributes timeToLive) {
// checkReadiness();
if (timeToLive == null) {
throw new IllegalArgumentException(LocalizedStrings.HARegion_TIMETOLIVE_MUST_NOT_BE_NULL.toLocalizedString());
}
if ((timeToLive.getAction() == ExpirationAction.LOCAL_DESTROY && this.dataPolicy.withReplication())) {
throw new IllegalArgumentException(LocalizedStrings.HARegion_TIMETOLIVE_ACTION_IS_INCOMPATIBLE_WITH_THIS_REGIONS_MIRROR_TYPE.toLocalizedString());
}
if (!this.statisticsEnabled) {
throw new IllegalStateException(LocalizedStrings.HARegion_CANNOT_SET_TIME_TO_LIVE_WHEN_STATISTICS_ARE_DISABLED.toLocalizedString());
}
ExpirationAttributes oldAttrs = getEntryTimeToLive();
this.entryTimeToLive = timeToLive.getTimeout();
this.entryTimeToLiveExpirationAction = timeToLive.getAction();
setEntryTimeToLiveAttributes();
updateEntryExpiryPossible();
timeToLiveChanged(oldAttrs);
return oldAttrs;
}
use of org.apache.geode.cache.ExpirationAttributes in project geode by apache.
the class RegionAttributesCreation method setEntryTimeToLive.
public ExpirationAttributes setEntryTimeToLive(ExpirationAttributes timeToLive) {
ExpirationAttributes old = this.entryTimeToLive;
this.entryTimeToLive = timeToLive;
setHasEntryTimeToLive(true);
return old;
}
Aggregations