/** * Sets the cache loader for the next <code>RegionAttributes</code> created. * * @param cacheLoader * the cache loader or null if no loader * @return a reference to this RegionFactory object * @see AttributesFactory#setCacheLoader * */ public RegionFactory<K,V> setCacheLoader(CacheLoader<K,V> cacheLoader) { this.attrsFactory.setCacheLoader(cacheLoader); return this; }
/** * Sets the cache loader for the next <code>RegionAttributes</code> created. * * @param cacheLoader * the cache loader or null if no loader * @return a reference to this RegionFactory object * @see AttributesFactory#setCacheLoader * */ public RegionFactory<K,V> setCacheLoader(CacheLoader<K,V> cacheLoader) { this.attrsFactory.setCacheLoader(cacheLoader); return this; }
public void run2() throws CacheException { AttributesFactory factory = new AttributesFactory(); factory.setCacheLoader(new CacheLoader() { public Object load(LoaderHelper helper) throws CacheLoaderException { return "Loaded value"; } public void close() { } }); createRegion(name, factory.create()); } });
public void run2() throws CacheException { AttributesFactory fac = new AttributesFactory(); if (index % 2 == 1) { fac.setCacheLoader(new CacheLoader() { public Object load(LoaderHelper helper) throws CacheLoaderException { return null; } public void close() { } }); } createRegion(rgnName, fac.create()); } });
public void run2() throws CacheException { Properties config = new Properties(); config.setProperty("mcast-port", "0"); system = (InternalDistributedSystem) DistributedSystem.connect(config); getCache(); AttributesFactory factory = new AttributesFactory(); factory.setScope(Scope.LOCAL); BridgeClient loader = new BridgeClient(); Properties props = new Properties(); props.setProperty("endpoints", "server=" + host0 + ":" + port); props.setProperty("establishCallbackConnection", "true"); loader.init(props); factory.setCacheLoader(loader); createRegion(name, factory.create()); } });
public AttributesFactory getBridgeServerRegionAttributes(CacheLoader cl, CacheWriter cw) { AttributesFactory ret = new AttributesFactory(); if (cl != null) { ret.setCacheLoader(cl); } if (cw != null) { ret.setCacheWriter(cw); } ret.setScope(Scope.DISTRIBUTED_ACK); ret.setConcurrencyChecksEnabled(false); return ret; }
public void run2() throws CacheException { final TestCacheLoader remoteloader = new TestCacheLoader() { public Object load2(LoaderHelper helper) throws CacheLoaderException { assertEquals(key, helper.getKey()); assertEquals(name, helper.getRegion().getName()); return value; } }; AttributesFactory factory = new AttributesFactory(getRegionAttributes()); factory.setCacheLoader(remoteloader); createRegion(name, factory.create()); } });
public AttributesFactory getBridgeServerMirroredRegionAttributes(CacheLoader cl, CacheWriter cw) { AttributesFactory ret = new AttributesFactory(); if (cl != null) { ret.setCacheLoader(cl); } if (cw != null) { ret.setCacheWriter(cw); } ret.setScope(Scope.DISTRIBUTED_NO_ACK); ret.setDataPolicy(DataPolicy.REPLICATE); ret.setConcurrencyChecksEnabled(false); return ret; }
public AttributesFactory getBridgeServerMirroredAckRegionAttributes(CacheLoader cl, CacheWriter cw) { AttributesFactory ret = new AttributesFactory(); if (cl != null) { ret.setCacheLoader(cl); } if (cw != null) { ret.setCacheWriter(cw); } ret.setScope(Scope.DISTRIBUTED_ACK); ret.setConcurrencyChecksEnabled(false); ret.setMirrorType(MirrorType.KEYS_VALUES); return ret; }
public static void createRegion(CacheLoader cacheLoader, CacheWriter cacheWriter, Integer localMaxMemory) { try { new PartitionedRegionLoaderWriterDUnitTest("DUnitTests") .createCache(new Properties()); AttributesFactory factory = new AttributesFactory(); factory.setCacheLoader(cacheLoader); factory.setCacheWriter(cacheWriter); PartitionAttributesFactory paf = new PartitionAttributesFactory(); paf.setLocalMaxMemory(localMaxMemory.intValue()); factory.setDataPolicy(DataPolicy.PARTITION); factory.setPartitionAttributes(paf.create()); RegionAttributes attrs = factory.create(); cache.createRegion(PartitionedRegionName, attrs); } catch (Exception e) { fail("Not Expected : " , e); } }
public void run2() throws CacheException { createConnection(null); AttributesFactory fac = new AttributesFactory(); fac.setScope(getRegionScope()); fac.setCacheLoader(new CacheLoader() { public Object load(LoaderHelper helper) throws CacheLoaderException { if ("netload".equals(helper.getKey())) { return "netload"; } else { return null; } } public void close() {} }); RegionAttributes attr = fac.create(); Region region = createRootRegion(name, attr); Object netsearch = "netsearch"; region.put(netsearch, netsearch); } });
public void run2() throws CacheException { createConnection(null); AttributesFactory fac = new AttributesFactory(); fac.setScope(getRegionScope()); fac.setCacheLoader(new CacheLoader() { public Object load(LoaderHelper helper) throws CacheLoaderException { if ("netload".equals(helper.getKey())) { return "netload"; } else { return null; } } public void close() {} }); RegionAttributes attr = fac.create(); Region region = createRootRegion(name, attr); Object netsearch = "netsearch"; region.put(netsearch, netsearch); } });
public void run() { Cache cache = getCache(); AttributesFactory attr = new AttributesFactory(); PartitionAttributesFactory paf = new PartitionAttributesFactory(); paf.setRedundantCopies(0); paf.setRecoveryDelay(-1); paf.setStartupRecoveryDelay(-1); PartitionAttributes prAttr = paf.create(); attr.setPartitionAttributes(prAttr); attr.setCacheLoader(new Bug40228Loader()); cache.createRegion("region1", attr.create()); } };
public void run() { Cache cache = getCache(); AttributesFactory attr = new AttributesFactory(); PartitionAttributesFactory paf = new PartitionAttributesFactory(); paf.setRedundantCopies(0); paf.setRecoveryDelay(-1); paf.setStartupRecoveryDelay(-1); PartitionAttributes prAttr = paf.create(); attr.setPartitionAttributes(prAttr); attr.setCacheLoader(new Bug40228Loader()); cache.createRegion("region1", attr.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.setCacheLoader(new TestCacheLoader() { public Object load2(LoaderHelper helper) throws CacheLoaderException { return value; } }); createRegion(name, 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.setCacheLoader(new TestCacheLoader() { public Object load2(LoaderHelper helper) throws CacheLoaderException { return value; } }); createRegion(name, 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); loader = new TestCacheLoader() { public Object load2(LoaderHelper helper) throws CacheLoaderException { fail("Should not be invoked"); return null; } }; factory.setCacheLoader(loader); createRegion(name, factory.create()); } };
public Object call() { Cache cache = getCache(); PoolFactory factory = PoolManager.createFactory(); factory.addServer(getServerHostName(host), serverPort); factory.create("pool1"); AttributesFactory af = new AttributesFactory(); af.setDataPolicy(DataPolicy.DEFAULT); af.setScope(Scope.LOCAL); af.setPoolName("pool1"); af.setCacheLoader(new MyCacheLoader("loaded")); RegionAttributes attrs = af.create(); cache.createRegion(regionName, attrs); return null; } });
public Object call() { //Make sure we get a distributed system that has the locator useLocator = true; Cache cache = getCache(); useLocator = false; PoolFactory factory = PoolManager.createFactory(); factory.addServer(getServerHostName(host), serverPort); factory.create("pool1"); AttributesFactory af = new AttributesFactory(); af.setDataPolicy(DataPolicy.NORMAL); af.setScope(Scope.DISTRIBUTED_ACK); af.setCacheLoader(new MyCacheLoader("loaded2")); af.setPoolName("pool1"); RegionAttributes attrs = af.create(); cache.createRegion(regionName, attrs); return null; } };
public Object call() { //Make sure we get a distributed system that has the locator useLocator = true; Cache cache = getCache(); useLocator = false; PoolFactory factory = PoolManager.createFactory(); factory.addServer(getServerHostName(host), serverPort); factory.create("pool1"); AttributesFactory af = new AttributesFactory(); af.setDataPolicy(DataPolicy.NORMAL); af.setScope(Scope.DISTRIBUTED_ACK); af.setPoolName("pool1"); af.setCacheLoader(new MyCacheLoader("loaded1")); RegionAttributes attrs = af.create(); cache.createRegion(regionName, attrs); return null; } };