public CacheLoader setCacheLoader(CacheLoader cacheLoader) { CacheLoader old = this.cacheLoader; this.cacheLoader = cacheLoader; setHasCacheLoader(true); if (cacheLoader instanceof BridgeClient && !hasCacheWriter()) { // fix for bug 36247 setCacheWriter((BridgeClient)cacheLoader); } return old; }
attrs.setCacheWriter((CacheWriter) d);
attrs.setCacheWriter((CacheWriter) d);
/** * Tests a cache writer with no parameters */ public void testCacheWriter() throws CacheException { CacheCreation cache = new CacheCreation(); RegionAttributesCreation attrs = new RegionAttributesCreation(cache); CacheWriter writer = new MyTestCacheWriter(); attrs.setCacheWriter(writer); cache.createRegion("root", attrs); testXml(cache); }
/** * Tests a bridge client and special setCacheWriter behavior on * region attributes */ public void testBridgeClientAsWriter() throws CacheException { getSystem(); CacheCreation cache = new CacheCreation(); RegionAttributesCreation attrs = new RegionAttributesCreation(cache); final int[] ports = AvailablePortHelper.getRandomAvailableTCPPorts(1); BridgeClient bc = new TestBridgeClient(); Properties props = new Properties(); props.setProperty("endpoints", "server=" + DistributedTestCase.getIPLiteral() + ":" + ports[0]); bc.init(props); attrs.setCacheWriter(bc); cache.createRegion("root", attrs); testXml(cache); final Region ro = cache.getRegion("root"); assertSame(ro.getAttributes().getCacheLoader(), ro.getAttributes().getCacheWriter()); assertTrue(ro.getAttributes().getCacheWriter() instanceof TestBridgeClient); // now that a BridgeLoader creates its own pool make sure it exists assertEquals("pools="+PoolManager.getAll(), 1, PoolManager.getAll().size()); }
/** * Tests a bridge client and special setCacheLoader over-ride behavior on * region attributes */ public void testBridgeClientLoaderOverride() throws CacheException { getSystem(); CacheCreation cache = new CacheCreation(); RegionAttributesCreation attrs = new RegionAttributesCreation(cache); final int[] ports = AvailablePortHelper.getRandomAvailableTCPPorts(1); BridgeClient bc = new TestBridgeClient(); Properties props = new Properties(); props.setProperty("endpoints", "server=" + DistributedTestCase.getIPLiteral() + ":" + ports[0]); bc.init(props); attrs.setCacheWriter(bc); attrs.setCacheLoader(new CacheLoaderWithDeclarables()); cache.createRegion("root", attrs); testXml(cache); final Region ro = cache.getRegion("root"); assertTrue(ro.getAttributes().getCacheWriter() instanceof BridgeClient); assertTrue(ro.getAttributes().getCacheLoader() instanceof CacheLoaderWithDeclarables); // now that a BridgeLoader creates its own pool make sure it exists assertEquals("pools="+PoolManager.getAll(), 1, PoolManager.getAll().size()); }
/** * Tests a bridge client and special setCacheWriter over-ride behavior on * region attributes */ public void testBridgeClientWriterOverride() throws CacheException { getSystem(); CacheCreation cache = new CacheCreation(); RegionAttributesCreation attrs = new RegionAttributesCreation(cache); final int[] ports = AvailablePortHelper.getRandomAvailableTCPPorts(1); BridgeClient bc = new TestBridgeClient(); Properties props = new Properties(); props.setProperty("endpoints", "server=" + DistributedTestCase.getIPLiteral() + ":" + ports[0]); bc.init(props); attrs.setCacheLoader(bc); attrs.setCacheWriter(new MyTestCacheWriter()); cache.createRegion("root", attrs); testXml(cache); final Region ro = cache.getRegion("root"); assertTrue(ro.getAttributes().getCacheLoader() instanceof BridgeClient); assertTrue(ro.getAttributes().getCacheWriter() instanceof MyTestCacheWriter); // now that a BridgeLoader creates its own pool make sure it exists assertEquals("pools="+PoolManager.getAll(), 1, PoolManager.getAll().size()); }
attr.setCacheLoader((CacheLoader)(TestHelper.createInstance(regDef.getCacheLoader()))); if (regDef.getCacheWriter() != null) attr.setCacheWriter((CacheWriter)(TestHelper.createInstance(regDef.getCacheWriter()))); if (regDef.getConcurrencyLevel() != null) attr.setConcurrencyLevel(regDef.getConcurrencyLevel().intValue());
if (parentIsUserSpecified) { if (parentWithHas.hasCacheWriter()) { setCacheWriter(parent.getCacheWriter()); setCacheWriter(parent.getCacheWriter());
if (parentIsUserSpecified) { if (parentWithHas.hasCacheWriter()) { setCacheWriter(parent.getCacheWriter()); setCacheWriter(parent.getCacheWriter());