public void testSetConcurrencyLevel() throws CacheException, IOException { Cache c = createCache(); Region r1 = null; try { RegionFactory factory = c.createRegionFactory(LOCAL); r1 = factory.setConcurrencyLevel(7).create(this.r1Name); RegionAttributes ra = r1.getAttributes(); assertEquals(7, ra.getConcurrencyLevel()); } finally { cleanUpRegion(r1); } }
@SuppressWarnings("deprecation") private void createRegionsWithSubRegions() { final Cache cache = getCache(); RegionFactory<String, Integer> dataRegionFactory = cache.createRegionFactory(RegionShortcut.REPLICATE); dataRegionFactory.setConcurrencyLevel(3); Region<String, Integer> region1 = dataRegionFactory.create(REGION1); region1.createSubregion(SUBREGION1C, region1.getAttributes()); Region<String, Integer> subregion2 = region1.createSubregion(SUBREGION1A, region1.getAttributes()); subregion2.createSubregion(SUBREGION1B, subregion2.getAttributes()); dataRegionFactory.create(REGION2); dataRegionFactory.create(REGION3); }
private void createRegionsWithSubRegions() { final Cache cache = getCache(); RegionFactory<String, Integer> dataRegionFactory = cache.createRegionFactory(RegionShortcut.REPLICATE); dataRegionFactory.setConcurrencyLevel(3); Region<String, Integer> region1 = dataRegionFactory.create(REGION1); region1.createSubregion(SUBREGION1C, region1.getAttributes()); Region<String, Integer> subregion2 = region1.createSubregion(SUBREGION1A, region1.getAttributes()); subregion2.createSubregion(SUBREGION1B, subregion2.getAttributes()); dataRegionFactory.create(REGION2); dataRegionFactory.create(REGION3); }
public void testRegionFactoryRegionAttributes() throws CacheException { Region r1 = null, r2 = null, r3 = null; try { Properties p = new Properties(); p.put("mcast-port", "0"); r1 = new RegionFactory(p).setScope(Scope.LOCAL) .setConcurrencyLevel(1).setLoadFactor(0.8F).setKeyConstraint( String.class).setStatisticsEnabled(true).create(r1Name); assertBasicRegionFunctionality(r1, r1Name); final RegionFactory factory = new RegionFactory(p, r1.getAttributes()); r2 = factory.create(r2Name); assertBasicRegionFunctionality(r2, r2Name); assertEquals(r1.getAttributes(), r2.getAttributes()); r3 = factory.create(r3Name); try { assertEquals(r2.getAttributes(), r3.getAttributes()); fail("Expected r2 attributes to be different from r3"); } catch (AssertionFailedError expected) { } } finally { cleanUpRegion(r1); cleanUpRegion(r2); cleanUpRegion(r3); } }
final Cache cache = getCache(); RegionFactory<String, Integer> dataRegionFactory = cache.createRegionFactory(RegionShortcut.REPLICATE_PROXY); dataRegionFactory.setConcurrencyLevel(5); Region<String, Integer> region1 = dataRegionFactory.create(REGION1);
private void createPartitionedRegion(String regionName) { final Cache cache = getCache(); // Create the data region RegionFactory<String, Integer> dataRegionFactory = cache.createRegionFactory(RegionShortcut.PARTITION); dataRegionFactory.setConcurrencyLevel(4); EvictionAttributes ea = EvictionAttributes.createLIFOEntryAttributes(100, EvictionAction.LOCAL_DESTROY); dataRegionFactory.setEvictionAttributes(ea); dataRegionFactory.setEnableAsyncConflation(true); FixedPartitionAttributes fpa = FixedPartitionAttributes.createFixedPartition("Par1", true); PartitionAttributes pa = new PartitionAttributesFactory() .setLocalMaxMemory(100) .setRecoveryDelay(2) .setTotalMaxMemory(200) .setRedundantCopies(1) .addFixedPartitionAttributes(fpa) .create(); dataRegionFactory.setPartitionAttributes(pa); dataRegionFactory.create(regionName); }
public void run() { final Cache cache = getCache(); RegionFactory<String, Integer> dataRegionFactory = cache.createRegionFactory(RegionShortcut.PARTITION); dataRegionFactory.setConcurrencyLevel(4); EvictionAttributes ea = EvictionAttributes.createLIFOEntryAttributes(100, EvictionAction.LOCAL_DESTROY); dataRegionFactory.setEvictionAttributes(ea); dataRegionFactory.setEnableAsyncConflation(true); FixedPartitionAttributes fpa = FixedPartitionAttributes.createFixedPartition("Par1", true); PartitionAttributes pa = new PartitionAttributesFactory() .setLocalMaxMemory(100) .setRecoveryDelay(2) .setTotalMaxMemory(200) .setRedundantCopies(1) .addFixedPartitionAttributes(fpa) .create(); dataRegionFactory.setPartitionAttributes(pa); dataRegionFactory.create(PR1); createLocalRegion(LOCALREGIONONMANAGER); } });
public void run() { getSystem(server1Props); final Cache cache = getCache(); RegionFactory<String, Integer> dataRegionFactory = cache.createRegionFactory(RegionShortcut.PARTITION); dataRegionFactory.setConcurrencyLevel(4); EvictionAttributes ea = EvictionAttributes.createLIFOEntryAttributes(100, EvictionAction.LOCAL_DESTROY); dataRegionFactory.setEvictionAttributes(ea); dataRegionFactory.setEnableAsyncConflation(true); FixedPartitionAttributes fpa = FixedPartitionAttributes.createFixedPartition("Par2", 4); PartitionAttributes pa = new PartitionAttributesFactory() .setLocalMaxMemory(150) .setRecoveryDelay(4) .setTotalMaxMemory(200) .setRedundantCopies(1) .addFixedPartitionAttributes(fpa) .create(); dataRegionFactory.setPartitionAttributes(pa); dataRegionFactory.create(PR1); createRegionsWithSubRegions(); } });
factory.setConcurrencyLevel(regionCreateArgs.getConcurrencyLevel());
private void createPartitionedRegion(String regionName) { final Cache cache = getCache(); // Create the data region RegionFactory<String, Integer> dataRegionFactory = cache.createRegionFactory(RegionShortcut.PARTITION); dataRegionFactory.setConcurrencyLevel(4); EvictionAttributes ea = EvictionAttributes.createLIFOEntryAttributes(100, EvictionAction.LOCAL_DESTROY); dataRegionFactory.setEvictionAttributes(ea); dataRegionFactory.setEnableAsyncConflation(true); FixedPartitionAttributes fpa = FixedPartitionAttributes.createFixedPartition("Par1", true); PartitionAttributes pa = new PartitionAttributesFactory() .setLocalMaxMemory(100) .setRecoveryDelay(2) .setTotalMaxMemory(200) .setRedundantCopies(1) .addFixedPartitionAttributes(fpa) .create(); dataRegionFactory.setPartitionAttributes(pa); dataRegionFactory.addCacheListener(new CacheListener1()); dataRegionFactory.addCacheListener(new CacheListener2()); dataRegionFactory.create(regionName); }
factory.setConcurrencyLevel(regionCreateArgs.getConcurrencyLevel());