TestOnlyHARegionQueue(String regionName, GemFireCacheImpl cache, HARegionQueueAttributes hrqa, Map haContainer, final byte clientConflation, boolean isPrimary) throws IOException, ClassNotFoundException, CacheException, InterruptedException { super(regionName, cache, hrqa, haContainer, null, clientConflation, isPrimary); ExpirationAttributes ea = new ExpirationAttributes(hrqa.getExpiryTime(), ExpirationAction.LOCAL_INVALIDATE); this.region.setOwner(this); this.region.getAttributesMutator().setEntryTimeToLive(ea); this.initialized.set(true); }
TestOnlyHARegionQueue(String regionName, GemFireCacheImpl cache, HARegionQueueAttributes hrqa, Map haContainer, final byte clientConflation, boolean isPrimary) throws IOException, ClassNotFoundException, CacheException, InterruptedException { super(regionName, cache, hrqa, haContainer, null, clientConflation, isPrimary); ExpirationAttributes ea = new ExpirationAttributes(hrqa.getExpiryTime(), ExpirationAction.LOCAL_INVALIDATE); this.region.setOwner(this); this.region.getAttributesMutator().setEntryTimeToLive(ea); this.initialized.set(true); }
/** * Changes the timeToLive expiration attributes for values in this region. * * @param timeToLive * the timeToLive expiration attributes for entries * @return the previous value of entry timeToLive * @throws IllegalArgumentException * if timeToLive is null or if the ExpirationAction is * LOCAL_DESTROY and the region is * {@link DataPolicy#withReplication replicated} or if the * ExpirationAction is LOCAL_INVALIDATE and the region is * {@link DataPolicy#withReplication replicated} * @throws IllegalStateException * if statistics are disabled for this region. */ @Override public ExpirationAttributes setEntryTimeToLive(ExpirationAttributes timeToLive) { ExpirationAttributes attr = super.setEntryTimeToLive(timeToLive); // Set to Bucket regions as well if (this.getDataStore() != null) { // not for accessors Iterator iter = this.getDataStore().getAllLocalBuckets().iterator(); while (iter.hasNext()) { Map.Entry entry = (Map.Entry)iter.next(); Region bucketRegion = (BucketRegion)entry.getValue(); bucketRegion.getAttributesMutator().setEntryTimeToLive(timeToLive); } } return attr; }
/** * Changes the timeToLive expiration attributes for values in this region. * * @param timeToLive * the timeToLive expiration attributes for entries * @return the previous value of entry timeToLive * @throws IllegalArgumentException * if timeToLive is null or if the ExpirationAction is * LOCAL_DESTROY and the region is * {@link DataPolicy#withReplication replicated} or if the * ExpirationAction is LOCAL_INVALIDATE and the region is * {@link DataPolicy#withReplication replicated} * @throws IllegalStateException * if statistics are disabled for this region. */ @Override public ExpirationAttributes setEntryTimeToLive(ExpirationAttributes timeToLive) { ExpirationAttributes attr = super.setEntryTimeToLive(timeToLive); // Set to Bucket regions as well if (this.getDataStore() != null) { // not for accessors Iterator iter = this.getDataStore().getAllLocalBuckets().iterator(); while (iter.hasNext()) { Map.Entry entry = (Map.Entry)iter.next(); Region bucketRegion = (BucketRegion)entry.getValue(); bucketRegion.getAttributesMutator().setEntryTimeToLive(timeToLive); } } updatePRConfig(getPRConfigWithLatestExpirationAttributes(), false); return attr; }
ExpirationAttributes ea = new ExpirationAttributes(hrqa.getExpiryTime(), ExpirationAction.LOCAL_INVALIDATE); hrq.region.getAttributesMutator().setEntryTimeToLive(ea);
ExpirationAttributes ea = new ExpirationAttributes(hrqa.getExpiryTime(), ExpirationAction.LOCAL_INVALIDATE); hrq.region.getAttributesMutator().setEntryTimeToLive(ea);
mutator.setEntryTimeToLive(parseExpirationAttributes(newEntryExpirationTTL, region.getEntryTimeToLive())); if (logger.isDebugEnabled()) { logger.debug("Region successfully altered - entry TTL");
/** * Expiration needs some more work in the new TX model. */ public void DISABLED_TILL_NEW_TX_IMPL_COMPLETE_testEntryTTLExpiration() throws CacheException { AttributesFactory af = new AttributesFactory(); af.setScope(Scope.DISTRIBUTED_NO_ACK); af.setStatisticsEnabled(true); af.setEntryTimeToLive(new ExpirationAttributes(2, ExpirationAction.DESTROY)); Region exprReg = this.cache.createRegion("TXEntryTTL", af.create()); generalEntryExpirationTest(exprReg, 2); AttributesMutator mutator = exprReg.getAttributesMutator(); mutator.setEntryTimeToLive(new ExpirationAttributes(1, ExpirationAction.DESTROY)); generalEntryExpirationTest(exprReg, 1); }
mutator.setEntryTimeToLive( new ExpirationAttributes(1, ExpirationAction.LOCAL_DESTROY)); sleep(2000);
Region region = HARegion.getInstance("HARegionJUnitTest_region", (GemFireCacheImpl)cache, null, ra); region.getAttributesMutator().setEntryTimeToLive(ea); return region;
mutator.setEntryTimeToLive(parseExpirationAttributes(newEntryExpirationTTL, region.getEntryTimeToLive())); if (logger != null) logger.fine("Region successfully altered - entry TTL");
mutator.setEntryTimeToLive(null); fail("Should have thrown an IllegalArgumentException"); mutator.setEntryTimeToLive(new ExpirationAttributes(1, ExpirationAction.DESTROY)); fail("Should have thrown an IllegalStateException"); } catch (IllegalStateException ex) {
mutator.setEntryTimeToLive( new ExpirationAttributes(1, ExpirationAction.LOCAL_DESTROY)); sleep(2000);
mutator.setEntryTimeToLive( new ExpirationAttributes(1, ExpirationAction.LOCAL_DESTROY)); sleep(2000);
ExpirationAttributes expire2 = new ExpirationAttributes(timeout2, ExpirationAction.INVALIDATE); mutt.setEntryTimeToLive(expire2); expire2 = new ExpirationAttributes(timeout2, ExpirationAction.INVALIDATE); mutt.setEntryTimeToLive(expire2);
break; case GfxdAttributesMutator.EXPIRE_ENTRY_TIMETOLIVE: attrsMutator.setEntryTimeToLive(expirationAttrs); break; case GfxdAttributesMutator.EXPIRE_ENTRY_IDLETIME:
break; case GfxdAttributesMutator.EXPIRE_ENTRY_TIMETOLIVE: attrsMutator.setEntryTimeToLive(expirationAttrs); break; case GfxdAttributesMutator.EXPIRE_ENTRY_IDLETIME:
mutator.setEntryTimeToLive(attrs.getEntryTimeToLive());
mutator.setEntryTimeToLive(attrs.getEntryTimeToLive());
mutator.setEntryIdleTimeout(entryIdle); mutator.setCustomEntryIdleTimeout(customEntryIdle); mutator.setEntryTimeToLive(entryTTL); mutator.setCustomEntryTimeToLive(customTtl); mutator.setRegionIdleTimeout(regionIdle); assertEquals(entryIdle, mutator.setEntryIdleTimeout(entryIdle2)); assertEquals(customEntryIdle, mutator.setCustomEntryIdleTimeout(customEntryIdle2)); assertEquals(entryTTL, mutator.setEntryTimeToLive(entryTTL2)); assertEquals(customTtl, mutator.setCustomEntryTimeToLive(customTtl2)); assertEquals(regionIdle, mutator.setRegionIdleTimeout(regionIdle2));