/** * Sets the kind of interest this region has in events occuring in other caches that define * the region by the same name. * @param sa the attributes decribing the interest * @return a reference to this RegionFactory object * @see AttributesFactory#setSubscriptionAttributes(SubscriptionAttributes) */ public RegionFactory<K,V> setSubscriptionAttributes(SubscriptionAttributes sa) { this.attrsFactory.setSubscriptionAttributes(sa); return this; }
/** * Sets the kind of interest this region has in events occuring in other caches that define * the region by the same name. * @param sa the attributes decribing the interest * @return a reference to this RegionFactory object * @see AttributesFactory#setSubscriptionAttributes(SubscriptionAttributes) */ public RegionFactory<K,V> setSubscriptionAttributes(SubscriptionAttributes sa) { this.attrsFactory.setSubscriptionAttributes(sa); return this; }
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 }
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 run2() throws CacheException { AttributesFactory factory = new AttributesFactory(); factory.setScope(Scope.DISTRIBUTED_ACK); // setting the following makes things legal factory.setDataPolicy(DataPolicy.NORMAL); factory.setSubscriptionAttributes(new SubscriptionAttributes(InterestPolicy.ALL)); createRootRegion(factory.create()); } });
public void run2() throws CacheException { AttributesFactory factory = new AttributesFactory(); factory.setScope(Scope.DISTRIBUTED_ACK); factory.setDataPolicy(DataPolicy.NORMAL); factory.setSubscriptionAttributes(new SubscriptionAttributes(InterestPolicy.ALL)); TestCacheListener cl = new TestCacheListener() { public void afterCreate2(EntryEvent event) { } public void afterUpdate2(EntryEvent event) { } public void afterInvalidate2(EntryEvent event) { } public void afterDestroy2(EntryEvent event) { } }; cl.enableEventHistory(); factory.addCacheListener(cl); createRootRegion(factory.create()); } });
/** * Create a region and install the given listener * * ACCESSED VIA REFLECTION */ protected static void createSubregionWhenDestroy(String name, SubscriptionAttributes subAttrs, GenericListener l, Integer ttl, ExpirationAction action) throws CacheException { Region region = getRegion(); AttributesFactory factory = new AttributesFactory(); factory.setStatisticsEnabled(true); factory.setSubscriptionAttributes(subAttrs); factory.setEntryTimeToLive(new ExpirationAttributes(ttl.intValue(), action)); factory.addCacheListener(l); factory.setPartitionAttributes((new PartitionAttributesFactory()).create()); region.createSubregion(name, factory.create()); } /**
public void run2() throws CacheException { AttributesFactory factory = new AttributesFactory(getRegionAttributes()); final boolean partitioned = getRegionAttributes().getPartitionAttributes() != null || getRegionAttributes().getDataPolicy().withPartitioning(); factory.setStatisticsEnabled(true); ExpirationAttributes expire = new ExpirationAttributes(timeout, ExpirationAction.DESTROY); factory.setEntryTimeToLive(expire); if (!getRegionAttributes().getDataPolicy().withReplication()&& ! partitioned) { factory.setDataPolicy(DataPolicy.NORMAL); factory.setSubscriptionAttributes(new SubscriptionAttributes(InterestPolicy.ALL)); } System.setProperty(LocalRegion.EXPIRY_MS_PROPERTY, "true"); try { createRegion(name, factory.create()); } finally { System.getProperties().remove(LocalRegion.EXPIRY_MS_PROPERTY); } } });
public void run2() throws CacheException { AttributesFactory factory = new AttributesFactory(); factory.setScope(Scope.DISTRIBUTED_ACK); factory.setConcurrencyChecksEnabled(false); factory.setDataPolicy(DataPolicy.EMPTY); factory.setSubscriptionAttributes(new SubscriptionAttributes(InterestPolicy.ALL)); createRegion(name, factory.create()); //pause(1000); try { startBridgeServer(0); } catch (Exception ex) { fail("While starting CacheServer", ex); } } };
public void run2() throws CacheException { final String expectedExceptions = "does not allow queued messages"; AttributesFactory factory = new AttributesFactory(); factory.setScope(Scope.DISTRIBUTED_ACK); // setting the following makes things legal factory.setDataPolicy(DataPolicy.NORMAL); factory.setSubscriptionAttributes(new SubscriptionAttributes(InterestPolicy.ALL)); getCache().getLogger().info("<ExpectedException action=add>" + expectedExceptions + "</ExpectedException>"); try { createRootRegion(factory.create()); fail("expected IllegalStateException"); } catch (IllegalStateException expected) { } finally { getCache().getLogger().info("<ExpectedException action=remove>" + expectedExceptions + "</ExpectedException>"); } } });
/** * Create a region and install the given listener * * ACCESSED VIA REFLECTION */ protected static void createSubregion(String name, SubscriptionAttributes subAttrs, GenericListener l) throws CacheException { Region region = getRegion(); AttributesFactory factory = new AttributesFactory(); factory.setStatisticsEnabled(true); factory.setSubscriptionAttributes(subAttrs); factory.addCacheListener(l); factory.setPartitionAttributes((new PartitionAttributesFactory()).create()); region.createSubregion(name, factory.create()); }
public void run2() throws CacheException { getLonerSystem(); AttributesFactory factory = new AttributesFactory(); factory.setScope(Scope.LOCAL); factory.setConcurrencyChecksEnabled(false); BridgeTestCase.configureConnectionPool(factory,host0,port,-1,true,-1,-1, null); factory.setCacheListener(new ControlListener()); factory.setDataPolicy(DataPolicy.EMPTY); factory.setSubscriptionAttributes(new SubscriptionAttributes(InterestPolicy.CACHE_CONTENT)); createRegion(name, factory.create()); } };
public void run2() throws CacheException { getLonerSystem(); AttributesFactory factory = new AttributesFactory(); factory.setScope(Scope.LOCAL); factory.setConcurrencyChecksEnabled(false); // create bridge writer BridgeTestCase.configureConnectionPool(factory,host0,port,-1,true,-1,-1, null); factory.addCacheListener(new ControlListener()); factory.setDataPolicy(DataPolicy.EMPTY); factory.setSubscriptionAttributes(new SubscriptionAttributes(InterestPolicy.ALL)); createRegion(name, factory.create()); } };
private static Region _createRegion(String name, int ttl, ExpirationAction action, SubscriptionAttributes subAttrs, GenericListener l) throws CacheException { Region region = getRegion(); AttributesFactory factory = new AttributesFactory(); factory.setStatisticsEnabled(true); factory.setEntryTimeToLive(new ExpirationAttributes(ttl, action)); factory.setSubscriptionAttributes(subAttrs); factory.addCacheListener(l); factory.setPartitionAttributes((new PartitionAttributesFactory()).create()); Region sub = region.createSubregion(name, factory.create()); return sub; }
public void run2() throws CacheException { getLonerSystem(); getCache(); AttributesFactory factory = new AttributesFactory(); factory.setScope(Scope.LOCAL); factory.setConcurrencyChecksEnabled(false); BridgeTestCase.configureConnectionPool(factory,host0,port,-1,true,-1,-1, null); CertifiableTestCacheListener l = new CertifiableTestCacheListener(getLogWriter()); factory.setCacheListener(l); factory.setDataPolicy(DataPolicy.EMPTY); factory.setSubscriptionAttributes(new SubscriptionAttributes(InterestPolicy.CACHE_CONTENT)); Region rgn = createRegion(name, factory.create()); rgn.registerInterestRegex(".*", false, false); } };
public void run2() throws CacheException { getLonerSystem(); getCache(); AttributesFactory factory = new AttributesFactory(); factory.setScope(Scope.LOCAL); factory.setConcurrencyChecksEnabled(false); BridgeTestCase.configureConnectionPool(factory,host0,port,-1,true,-1,-1, null); CertifiableTestCacheListener l = new CertifiableTestCacheListener(getLogWriter()); factory.setCacheListener(l); factory.setDataPolicy(DataPolicy.EMPTY); factory.setSubscriptionAttributes(new SubscriptionAttributes(InterestPolicy.ALL)); Region rgn = createRegion(name, factory.create()); rgn.registerInterestRegex(".*", false, false); } };
public void run2() throws CacheException { beginCacheXml(); { // root region must be DACK because its used to sync up async subregions AttributesFactory factory = new AttributesFactory(); factory.setScope(Scope.DISTRIBUTED_ACK); factory.setDataPolicy(DataPolicy.NORMAL); factory.setSubscriptionAttributes(new SubscriptionAttributes(InterestPolicy.ALL)); createRootRegion(factory.create()); } { AttributesFactory factory = new AttributesFactory(getRegionAttributes()); factory.setDataPolicy(DataPolicy.REPLICATE); createRegion(name, factory.create()); } finishCacheXml(name); // reset slow com.gemstone.gemfire.internal.cache.InitialImageOperation.slowImageProcessing = 0; } };
public void run() { Cache cache = getCache(); ResourceManager manager = cache.getResourceManager(); manager.setCriticalHeapPercentage(95); manager.setEvictionHeapPercentage(90); AttributesFactory<Integer, TestDelta> attr = new AttributesFactory<Integer, TestDelta>(); PartitionAttributesFactory<Integer, TestDelta> paf = new PartitionAttributesFactory<Integer, TestDelta>(); paf.setRedundantCopies(1); attr.setEvictionAttributes(EvictionAttributes.createLRUHeapAttributes( new TestObjectSizer(), EvictionAction.LOCAL_DESTROY)); PartitionAttributes<Integer, TestDelta> prAttr = paf.create(); attr.setPartitionAttributes(prAttr); attr.setDataPolicy(DataPolicy.PARTITION); attr.setSubscriptionAttributes(new SubscriptionAttributes(InterestPolicy.ALL)); Region<Integer, TestDelta> region = cache.createRegion("region", attr.create()); } });
public void run() { Cache cache = getCache(); AttributesFactory<Integer, TestDelta> attr = new AttributesFactory<Integer, TestDelta>(); attr.setDiskSynchronous(true); PartitionAttributesFactory<Integer, TestDelta> paf = new PartitionAttributesFactory<Integer, TestDelta>(); paf.setRedundantCopies(1); if(enableLRU) { paf.setLocalMaxMemory(1); // memlru limit is 1 megabyte attr.setEvictionAttributes(EvictionAttributes.createLRUMemoryAttributes(new TestObjectSizer(), EvictionAction.OVERFLOW_TO_DISK)); attr.setDiskDirs(getMyDiskDirs()); } PartitionAttributes<Integer, TestDelta> prAttr = paf.create(); attr.setPartitionAttributes(prAttr); attr.setDataPolicy(DataPolicy.PARTITION); attr.setSubscriptionAttributes(new SubscriptionAttributes(InterestPolicy.ALL)); Region<Integer, TestDelta> region = cache.createRegion("region", attr.create()); } });
/** * make sure a remote create will be done in a NORMAL+ALL region * @param rmtCreate is true if create should happen in remote region */ private void remoteCreate(DataPolicy dp, InterestPolicy ip, boolean rmtCreate) throws CacheException { initOtherId(); AttributesFactory af = new AttributesFactory(); af.setDataPolicy(dp); af.setSubscriptionAttributes(new SubscriptionAttributes(ip)); af.setScope(Scope.DISTRIBUTED_ACK); Region r1 = createRootRegion("r1", af.create()); assertEquals(false, r1.containsKey("key")); doCreateOtherVm(); if (rmtCreate) { assertEquals(true, r1.containsKey("key")); assertEquals("value", r1.getEntry("key").getValue()); } else { assertEquals(false, r1.containsKey("key")); } } // TODO these are never used