/** * Adds a cache listener to the end of the list of cache listeners on this factory. * @param aListener the cache listener to add * @return a reference to this RegionFactory object * @throws IllegalArgumentException if <code>aListener</code> is null * @see AttributesFactory#addCacheListener */ public RegionFactory<K,V> addCacheListener(CacheListener<K,V> aListener) { this.attrsFactory.addCacheListener(aListener); return this; }
public ClientRegionFactory<K,V> addCacheListener(CacheListener<K,V> aListener) { this.attrsFactory.addCacheListener(aListener); return this; }
public ClientRegionFactory<K,V> addCacheListener(CacheListener<K,V> aListener) { this.attrsFactory.addCacheListener(aListener); return this; }
/** * Adds a cache listener to the end of the list of cache listeners on this factory. * @param aListener the cache listener to add * @return a reference to this RegionFactory object * @throws IllegalArgumentException if <code>aListener</code> is null * @see AttributesFactory#addCacheListener */ public RegionFactory<K,V> addCacheListener(CacheListener<K,V> aListener) { this.attrsFactory.addCacheListener(aListener); return this; }
public void run2() throws CacheException { AttributesFactory fac = new AttributesFactory(getRegionAttributes()); fac.addCacheListener(destroyListener = new DestroyListener()); Region region = null; System.setProperty(LocalRegion.EXPIRY_MS_PROPERTY, "true"); try { region = createRegion(name, fac.create()); } finally { System.getProperties().remove(LocalRegion.EXPIRY_MS_PROPERTY); } } };
public static void createClientCache(String host, Integer port1 , Integer port2) throws Exception { PORT1 = port1.intValue(); PORT2 = port2.intValue(); Properties props = new Properties(); props.setProperty(DistributionConfig.MCAST_PORT_NAME, "0"); props.setProperty(DistributionConfig.LOCATORS_NAME, ""); new HAGIIDUnitTest("temp").createCache(props); AttributesFactory factory = new AttributesFactory(); BridgeTestCase.configureConnectionPool(factory, host, new int[] {PORT1,PORT2}, true, -1, 2, null, 1000, -1, false, -1); factory.setScope(Scope.DISTRIBUTED_ACK); factory.addCacheListener(HAGIIDUnitTest.checker); RegionAttributes attrs = factory.create(); cache.createRegion(REGION_NAME, attrs); }
public void run2() throws CacheException { Cache cache = getCache(); AttributesFactory factory = new AttributesFactory(); factory.addCacheListener(new CacheListener2()); factory.addCacheListener(new CacheListener1()); factory.setScope(scope); RegionAttributes attrs = factory.create(); Region region = cache.createRegion(name, attrs); } });
public void run2() throws CacheException { AttributesFactory factory2 = new AttributesFactory(); factory2.setScope(Scope.LOCAL); factory2.addCacheListener(new MyListener(false)); createRegion("localsave", factory2.create()); Region region = doPutAll(regionName, "key-", numberOfEntries); assertEquals(numberOfEntries, region.size()); } });
public static Region createVMRegion(Cache cache, String regionName, Scope scope, DataPolicy dataPolicy, CacheListener listener) throws CacheException { AttributesFactory factory = new AttributesFactory(); factory.setScope(scope); factory.setDataPolicy(dataPolicy); if (listener != null) { factory.addCacheListener(listener); } RegionAttributes attr = factory.create(); return cache.createRegion(regionName, attr); }
public Object call() throws Exception { AttributesFactory af = new AttributesFactory(); af.setDataPolicy(DataPolicy.REPLICATE); af.setScope(Scope.DISTRIBUTED_ACK); CacheListener cl1 = new CacheListenerAdapter() { public void afterCreate(EntryEvent e) { getLogWriter().info("op:"+e.getOperation().toString()); assertTrue(!e.getOperation().isLocalLoad()); } }; af.addCacheListener(cl1); createRootRegion("r1", af.create()); return null; } });
public void run2() throws CacheException { Cache cache = getCache(); AttributesFactory factory = new AttributesFactory(); factory.addCacheListener(new CacheListener2()); factory.setScope(scope); RegionAttributes attrs = factory.create(); Region region = cache.createRegion(name, attrs); } });
protected Region createParentRegion(String name, boolean wanEnable) throws CacheException { final AttributesFactory factory = new AttributesFactory(); setParentRegionScope(factory); setStoragePolicy(factory); factory.setEnableGateway(wanEnable); factory.addCacheListener(new AtlanticTestCacheListener()); final Region r = createRootRegion(name, factory.create()); return r; }
private void createHARegion(String processedRegionName, GemFireCacheImpl cache) throws IOException, ClassNotFoundException { AttributesFactory af = new AttributesFactory(); af.setMirrorType(MirrorType.KEYS_VALUES); af.addCacheListener(createCacheListenerForHARegion()); af.setStatisticsEnabled(true); RegionAttributes ra = af.create(); this.region = HARegion.getInstance(processedRegionName, cache, this, ra); if (isPrimary) {//fix for 41878 // since it's primary queue, we will disable the EntryExpiryTask // this should be done after region creation disableEntryExpiryTasks(); } }
protected Region createParentRegionOnClient(String name, boolean wanEnable, PoolImpl pool) throws CacheException { final AttributesFactory factory = new AttributesFactory(); factory.setScope(Scope.LOCAL); factory.setEnableGateway(wanEnable); factory.setPoolName(pool.getName()); factory.addCacheListener(new AtlanticTestCacheListener()); final Region r = createRootRegion(name, factory.create()); return r; } protected Region createParentRegion(String name, boolean wanEnable) throws CacheException {
private void createHARegion(String processedRegionName, GemFireCacheImpl cache) throws IOException, ClassNotFoundException { AttributesFactory af = new AttributesFactory(); af.setMirrorType(MirrorType.KEYS_VALUES); af.addCacheListener(createCacheListenerForHARegion()); af.setStatisticsEnabled(true); RegionAttributes ra = af.create(); this.region = HARegion.getInstance(processedRegionName, cache, this, ra); if (isPrimary) {//fix for 41878 // since it's primary queue, we will disable the EntryExpiryTask // this should be done after region creation disableEntryExpiryTasks(); } }
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); // make sure empty works with client publishers createRegion(name, 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()); } });
public void run2() throws CacheException { RegionAttributes ra = getRegionAttributes(); AttributesFactory factory = new AttributesFactory(ra); if (ra.getEvictionAttributes() == null || !ra.getEvictionAttributes().getAction().isOverflowToDisk()) { factory.setDiskStoreName(null); } factory.setDataPolicy(DataPolicy.REPLICATE); factory.addCacheListener(new MirroredDataFromNonMirroredListener()); 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; }