public void testDestroyWithClosedRegion() { DiskStoreFactory dsf = cache.createDiskStoreFactory(); String name = "testDestroy"; DiskStore ds = dsf.create(name); Region region = cache.createRegionFactory(RegionShortcut.LOCAL_PERSISTENT) .setDiskStoreName("testDestroy") .create("region"); region.close(); //This should now work ds.destroy(); }
public <K, V> Set<Integer> getLocalBucketSet(Region<K, V> region) { if (!region.getAttributes().getDataPolicy().withPartitioning()) { return null; } return this.localBucketSet; } }
private Region createRegion(String regionName) { if(cache.findDiskStore("store") == null) { cache.createDiskStoreFactory() .setMaxOplogSize(1) .setDiskDirs(dirs) .create("store"); } Region region = cache.createRegionFactory() .setDiskStoreName("store") .setDataPolicy(DataPolicy.PERSISTENT_REPLICATE).create(regionName); return region; }
public void testSetEvictionAttributes() throws CacheException, IOException { Cache c = createCache(); Region r1 = null; try { RegionFactory factory = c.createRegionFactory(LOCAL); r1 = factory.setEvictionAttributes(EvictionAttributes.createLRUEntryAttributes(77)).create(this.r1Name); RegionAttributes ra = r1.getAttributes(); assertEquals(EvictionAttributes.createLRUEntryAttributes(77), ra.getEvictionAttributes()); } finally { cleanUpRegion(r1); } }
public void testSetCacheWriter() throws CacheException, IOException { Cache c = createCache(); Region r1 = null; try { RegionFactory factory = c.createRegionFactory(REPLICATE_PROXY); CacheWriter cw = new MyCacheWriter(); r1 = factory.setCacheWriter(cw).create(this.r1Name); RegionAttributes ra = r1.getAttributes(); assertEquals(cw, ra.getCacheWriter()); } finally { cleanUpRegion(r1); } }
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); } }
public void testSetInitialCapacity() throws CacheException, IOException { Cache c = createCache(); Region r1 = null; try { RegionFactory factory = c.createRegionFactory(LOCAL); r1 = factory.setInitialCapacity(777).create(this.r1Name); RegionAttributes ra = r1.getAttributes(); assertEquals(777, ra.getInitialCapacity()); } finally { cleanUpRegion(r1); } }
public void testAddCacheListener() throws CacheException, IOException { Cache c = createCache(); Region r1 = null; try { RegionFactory factory = c.createRegionFactory(REPLICATE_PROXY); CacheListener cl = new MyCacheListener(); r1 = factory.addCacheListener(cl).create(this.r1Name); RegionAttributes ra = r1.getAttributes(); assertEquals(cl, ra.getCacheListener()); } finally { cleanUpRegion(r1); } }
/** * Returns true if the underlying region is partitioned and has redundancy. * * @return true if region is partitioned and redundant. */ public final boolean isRedundant() { if (this.regionAttributes.getDataPolicy().withPartitioning()) { return this.regionAttributes.getPartitionAttributes() .getRedundantCopies() > 0; } return false; }
public void testSetValueConstraint() throws CacheException, IOException { Cache c = createCache(); Region r1 = null; try { RegionFactory factory = c.createRegionFactory(LOCAL); r1 = factory.setValueConstraint(String.class).create(this.r1Name); RegionAttributes ra = r1.getAttributes(); assertEquals(String.class, ra.getValueConstraint()); } finally { cleanUpRegion(r1); } }
public void testSetStatisticsEnabled() throws CacheException, IOException { Cache c = createCache(); Region r1 = null; try { RegionFactory factory = c.createRegionFactory(LOCAL); r1 = factory.setStatisticsEnabled(true).create(this.r1Name); RegionAttributes ra = r1.getAttributes(); assertEquals(true, ra.getStatisticsEnabled()); } finally { cleanUpRegion(r1); } }
public void testSetEnableSubscriptionConflation() throws CacheException, IOException { Cache c = createCache(); Region r1 = null; try { RegionFactory factory = c.createRegionFactory(LOCAL); r1 = factory.setEnableSubscriptionConflation(true).create(this.r1Name); RegionAttributes ra = r1.getAttributes(); assertEquals(true, ra.getEnableSubscriptionConflation()); } finally { cleanUpRegion(r1); } }
public void testSetLockGrantor() throws CacheException, IOException { Cache c = createCache(); Region r1 = null; try { RegionFactory factory = c.createRegionFactory(REPLICATE); r1 = factory.setScope(Scope.GLOBAL).setLockGrantor(true).create(this.r1Name); RegionAttributes ra = r1.getAttributes(); assertEquals(true, ra.isLockGrantor()); } finally { cleanUpRegion(r1); } }
public Object call() throws IOException { Cache cache = getCache(); AttributesFactory af = new AttributesFactory(); RegionAttributes attrs = af.create(); cache.createRegion(regionName, attrs); startBridgeServer(serverPort, true); return null; } });
public void testForceRoll() { DiskStoreFactory dsf = cache.createDiskStoreFactory(); String name = "testForceRoll"; DiskStore ds = dsf.create(name); ds.forceRoll(); }
private void initAttributeFactoryDefaults() { this.attrsFactory.setScope(Scope.LOCAL); this.attrsFactory.setSubscriptionAttributes(new SubscriptionAttributes(InterestPolicy.ALL)); // this.attrsFactory.setIgnoreJTA(true); in 6.6 and later releases client regions support JTA }
public void addCacheListener(CacheListener listener) { AttributesMutator mutator = this._region.getAttributesMutator(); mutator.setCacheListener(listener); }
/** * Returns true if the underlying region is partitioned and has redundancy. * * @return true if region is partitioned and redundant. */ public final boolean isRedundant() { if (this.regionAttributes.getDataPolicy().withPartitioning()) { return this.regionAttributes.getPartitionAttributes() .getRedundantCopies() > 0; } return false; }
public Object call() throws IOException { Cache cache = getCache(); AttributesFactory af = new AttributesFactory(); RegionAttributes attrs = af.create(); cache.createRegion(regionName, attrs); startBridgeServer(serverPort, true); return null; } });