@Override public ClientRegionFactory<K, V> setValueConstraint(Class<V> valueConstraint) { this.attrsFactory.setValueConstraint(valueConstraint); return this; }
/** * Sets the value constraint for the next {@code RegionAttributes} created. Values in the region * will be constrained to this class (or subclass). Any attempt to store a value of an * incompatible type in the region will cause a {@code ClassCastException} to be thrown. * * @param valueConstraint The Class to constrain the values to, or null if no constraint * @return a reference to this RegionFactory object * @throws IllegalArgumentException if {@code valueConstraint} is a class denoting a primitive * type * @see AttributesFactory#setValueConstraint */ public RegionFactory<K, V> setValueConstraint(Class<V> valueConstraint) { this.attrsFactory.setValueConstraint(valueConstraint); return this; }
public static Region createRegion(Region parentRegion, String regionName, Class valueConstraint) { try { AttributesFactory attributesFactory = new AttributesFactory(); if (valueConstraint != null) attributesFactory.setValueConstraint(valueConstraint); RegionAttributes regionAttributes = attributesFactory.create(); return parentRegion.createSubregion(regionName, regionAttributes); } catch (Exception e) { throw new AssertionError(e); } }
public static Region createRegion(String regionName, Class valueConstraint, boolean indexMaintenanceSynchronous) { try { AttributesFactory attributesFactory = new AttributesFactory(); attributesFactory.setValueConstraint(valueConstraint); attributesFactory.setIndexMaintenanceSynchronous(indexMaintenanceSynchronous); RegionAttributes regionAttributes = attributesFactory.create(); return cache.createRegion(regionName, regionAttributes); } catch (Exception e) { throw new AssertionError(e); } }
public static Region createRegion(String regionName, Class valueConstraint, Scope scope) { try { AttributesFactory attributesFactory = new AttributesFactory(); attributesFactory.setValueConstraint(valueConstraint); if (scope != null) { attributesFactory.setScope(scope); } RegionAttributes regionAttributes = attributesFactory.create(); return cache.createRegion(regionName, regionAttributes); } catch (Exception e) { throw new AssertionError(e); } }
attributesFactory.setScope(Scope.DISTRIBUTED_ACK); attributesFactory.setStatisticsEnabled(false); attributesFactory.setValueConstraint(String.class);
@Override public Region createRegion(String regionName, Class valueConstraint) { PartitionAttributesFactory paf = new PartitionAttributesFactory(); AttributesFactory af = new AttributesFactory(); af.setPartitionAttributes(paf.create()); af.setValueConstraint(valueConstraint); Region r1 = CacheUtils.createRegion(regionName, af.create(), false); return r1; }
static Region createRegion(String regionName, Class valueConstraint) throws Exception { AttributesFactory attributesFactory = new AttributesFactory(); attributesFactory.setValueConstraint(valueConstraint); RegionAttributes regionAttributes = attributesFactory.create(); Region region = _cache.createRegion(regionName, regionAttributes); return region; }
afactory.setValueConstraint(null);
private void setUp() throws CacheException { this.ds = DistributedSystem.connect(new Properties()); this.cache = CacheFactory.create(ds); AttributesFactory attributesFactory = new AttributesFactory(); attributesFactory.setValueConstraint(Portfolio.class); this.regionAttributes = attributesFactory.create(); this.qs = this.cache.getQueryService(); }
/** * 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); } }
} else { af.setScope(Scope.DISTRIBUTED_ACK); af.setValueConstraint(DynamicRegionAttributes.class);