@Override public ClientRegionFactory<K, V> setEntryTimeToLive(ExpirationAttributes timeToLive) { this.attrsFactory.setEntryTimeToLive(timeToLive); return this; }
/** * Sets the timeToLive expiration attributes for region entries for the next * {@code RegionAttributes} created. * * @param timeToLive the timeToLive ExpirationAttributes for entries in this region * @return a reference to this RegionFactory object * @throws IllegalArgumentException if timeToLive is null * @see AttributesFactory#setEntryTimeToLive */ public RegionFactory<K, V> setEntryTimeToLive(ExpirationAttributes timeToLive) { this.attrsFactory.setEntryTimeToLive(timeToLive); return this; }
@Override public void run2() throws CacheException { RegionAttributes<?, ?> ra = getRegionAttributes(); AttributesFactory<?, ?> factory = new AttributesFactory<>(ra); final boolean partitioned = ra.getPartitionAttributes() != null || ra.getDataPolicy().withPartitioning(); // MUST be nonmirrored, so turn off persistBackup if this is a disk region test if (!partitioned) { if (ra.getEvictionAttributes() == null || !ra.getEvictionAttributes().getAction().isOverflowToDisk()) { factory.setDiskStoreName(null); } factory.setDataPolicy(DataPolicy.NORMAL); } factory.setStatisticsEnabled(true); ExpirationAttributes expire = new ExpirationAttributes(shortTimeout, ExpirationAction.DESTROY); factory.setEntryTimeToLive(expire); System.setProperty(LocalRegion.EXPIRY_MS_PROPERTY, "true"); try { createRegion(name, factory.create()); } finally { System.getProperties().remove(LocalRegion.EXPIRY_MS_PROPERTY); } } });
factory.setEntryTimeToLive(expire); factory.setStatisticsEnabled(true); RegionAttributes attrs = factory.create();
factory.setEntryTimeToLive(expire); factory.setStatisticsEnabled(true); RegionAttributes attrs = factory.create();
factory.setEntryTimeToLive(expire); factory.setStatisticsEnabled(true); factory.setCacheLoader(new TestCacheLoader() {
public final <K, V> Region<K, V> createRegion(final String name, final String rootName, final RegionAttributes<K, V> attributes) throws CacheException { Region<K, V> root = getRootRegion(rootName); if (root == null) { // don't put listeners on root region AttributesFactory<K, V> attributesFactory = new AttributesFactory<>(attributes); ExpirationAttributes expiration = ExpirationAttributes.DEFAULT; attributesFactory.setCacheLoader(null); attributesFactory.setCacheWriter(null); attributesFactory.setPoolName(null); attributesFactory.setPartitionAttributes(null); attributesFactory.setRegionTimeToLive(expiration); attributesFactory.setEntryTimeToLive(expiration); attributesFactory.setRegionIdleTimeout(expiration); attributesFactory.setEntryIdleTimeout(expiration); RegionAttributes<K, V> rootAttrs = attributesFactory.create(); root = createRootRegion(rootName, rootAttrs); } return root.createSubregion(name, attributes); }
/** * This method creates the client health monitoring region. * <p> * GuardedBy ClientHealthMonitoringRegion.class * * @param cache The current GemFire Cache */ private static void initialize(InternalCache cache) { try { AttributesFactory factory = new AttributesFactory(); factory.setScope(Scope.LOCAL); factory.setEntryTimeToLive( new ExpirationAttributes(ADMIN_REGION_EXPIRY_INTERVAL, ExpirationAction.DESTROY)); cache.getLogger().fine("ClientHealthMonitoringRegion, setting TTL for entry...."); factory.addCacheListener(prepareCacheListener()); factory.setValueConstraint(ClientHealthStats.class); factory.setStatisticsEnabled(true); RegionAttributes regionAttrs = factory.create(); InternalRegionArguments internalArgs = new InternalRegionArguments(); internalArgs.setIsUsedForMetaRegion(true); internalArgs.setIsUsedForPartitionedRegionAdmin(false); currentInstance = cache.createVMRegion(ADMIN_REGION_NAME, regionAttrs, internalArgs); } catch (Exception ex) { cache.getLogger().error( "Error while creating an admin region", ex); } }
factory.setEntryTimeToLive(expire1); factory.setStatisticsEnabled(true); TestCacheListener list = new TestCacheListener() {
factory.setEntryIdleTimeout(expireIdle); ExpirationAttributes expireTtl = new ExpirationAttributes(timeout, ExpirationAction.DESTROY); factory.setEntryTimeToLive(expireTtl); factory.setStatisticsEnabled(true); RegionAttributes attrs = factory.create();
factory.setEntryTimeToLive(destroy); factory.setStatisticsEnabled(false); try {