public String getCacheWriter() { Object o = this.ra.getCacheWriter(); if (o == null) { return ""; } else { return o.toString(); } }
public String getCacheWriter() { Object o = this.ra.getCacheWriter(); if (o == null) { return ""; } else { return o.toString(); } }
protected static TestCacheWriter getTestWriter(Region r) { return (TestCacheWriter)r.getAttributes().getCacheWriter(); } /**
public Object call() throws Exception { Region refRegion = getCache().getRegion(D_REFERENCE); OriginRemoteRRWriter w = (OriginRemoteRRWriter)refRegion .getAttributes().getCacheWriter(); assertEquals(1, w.fireC); assertEquals(1, w.fireD); assertEquals(1, w.fireU); return null; } });
@SuppressWarnings("deprecation") public FetchRegionAttributesFunctionResult(AttributesFactory<K, V> afactory) { this.regionAttributes = afactory.create(); CacheListener<K, V>[] cacheListeners = this.regionAttributes.getCacheListeners(); if (cacheListeners != null && cacheListeners.length != 0) { cacheListenerClasses = new String[cacheListeners.length]; for (int i = 0; i < cacheListeners.length; i++) { cacheListenerClasses[i] = cacheListeners[i].getClass().getName(); } afactory.initCacheListeners(null); } CacheLoader<K, V> cacheLoader = this.regionAttributes.getCacheLoader(); if (cacheLoader != null) { cacheLoaderClass = cacheLoader.getClass().getName(); afactory.setCacheLoader(null); } CacheWriter<K, V> cacheWriter = this.regionAttributes.getCacheWriter(); if (cacheWriter != null) { cacheWriterClass = cacheWriter.getClass().getName(); afactory.setCacheWriter(null); } // recreate attributes this.regionAttributes = afactory.create(); }
public Object call() throws Exception { Region cust = getCache().getRegion(D_REFERENCE); OneDestroyAndThenOneCreateCacheWriter wri = (OneDestroyAndThenOneCreateCacheWriter)cust.getAttributes().getCacheWriter(); wri.checkSuccess(); return null; } });
public Object call() throws Exception { Region refRegion = getCache().getRegion(D_REFERENCE); assertNull(refRegion.getAttributes().getCacheWriter()); return null; } });
@Override public void run() { RegionAttributes attributes = getCache().getRegion(alterRegionName).getAttributes(); assertEquals(35464, attributes.getEvictionAttributes().getMaximum()); assertEquals(3453, attributes.getEntryIdleTimeout().getTimeout()); assertTrue(attributes.getEntryIdleTimeout().getAction().isDestroy()); assertEquals(7563, attributes.getEntryTimeToLive().getTimeout()); assertTrue(attributes.getEntryTimeToLive().getAction().isDestroy()); assertEquals(6234, attributes.getRegionIdleTimeout().getTimeout()); assertTrue(attributes.getRegionIdleTimeout().getAction().isDestroy()); assertEquals(4562, attributes.getRegionTimeToLive().getTimeout()); assertTrue(attributes.getRegionTimeToLive().getAction().isDestroy()); assertEquals(1, attributes.getAsyncEventQueueIds().size()); assertTrue(attributes.getAsyncEventQueueIds().contains(alterAsyncEventQueueId1)); assertEquals(1, attributes.getGatewaySenderIds().size()); assertTrue(attributes.getGatewaySenderIds().contains(alterGatewaySenderId1)); assertEquals(1, attributes.getCacheListeners().length); assertEquals("com.cadrdunit.RegionAlterCacheListenerA", attributes.getCacheListeners()[0].getClass().getName()); assertEquals("com.cadrdunit.RegionAlterCacheWriter", attributes.getCacheWriter().getClass().getName()); assertEquals("com.cadrdunit.RegionAlterCacheLoader", attributes.getCacheLoader().getClass().getName()); } });
public static void removeGfxdCacheWriterLocally( final GemFireContainer container) throws StandardException { @SuppressWarnings("unchecked") final Region<Object, Object> reg = container.getRegion(); final CacheWriter<Object, Object> prevWriter = reg.getAttributes() .getCacheWriter(); if (prevWriter == null) { return; } try { final AttributesMutator<Object, Object> mutator = reg .getAttributesMutator(); mutator.setCacheWriter(null); } catch (Exception ex) { throw StandardException.newException( SQLState.UNEXPECTED_EXCEPTION_FOR_WRITER, ex, container.getQualifiedTableName(), ex.toString()); } }
public static void removeGfxdCacheWriterLocally( final GemFireContainer container) throws StandardException { @SuppressWarnings("unchecked") final Region<Object, Object> reg = container.getRegion(); final CacheWriter<Object, Object> prevWriter = reg.getAttributes() .getCacheWriter(); if (prevWriter == null) { return; } try { final AttributesMutator<Object, Object> mutator = reg .getAttributesMutator(); mutator.setCacheWriter(null); } catch (Exception ex) { throw StandardException.newException( SQLState.UNEXPECTED_EXCEPTION_FOR_WRITER, ex, container.getQualifiedTableName(), ex.toString()); } }
public void run2() throws CacheException { Region region = getRootRegion().getSubregion(name); BridgeClient writer = (BridgeClient) region.getAttributes().getCacheWriter(); writer.close(); region.getAttributesMutator().setCacheWriter(null); } });
public static void removeGfxdCacheWriterLocally( final GemFireContainer container) throws StandardException { @SuppressWarnings("unchecked") final Region<Object, Object> reg = container.getRegion(); final CacheWriter<Object, Object> prevWriter = reg.getAttributes() .getCacheWriter(); if (prevWriter == null) { return; } try { final AttributesMutator<Object, Object> mutator = reg .getAttributesMutator(); mutator.setCacheWriter(null); } catch (Exception ex) { throw StandardException.newException( SQLState.UNEXPECTED_EXCEPTION_FOR_WRITER, ex, container.getQualifiedTableName(), ex.toString()); } }
public void run2() throws CacheException { Region region = getRootRegion().getSubregion(name); BridgeClient writer = (BridgeClient) region.getAttributes().getCacheWriter(); writer.close(); region.getAttributesMutator().setCacheWriter(null); } });
public void run2() throws CacheException { Region region = getRootRegion().getSubregion(name); BridgeClient writer = (BridgeClient) region.getAttributes().getCacheWriter(); writer.close(); region.getAttributesMutator().setCacheWriter(null); } });
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); } }
/** * 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 setCacheWriter behavior on * region attributes */ public void testBridgeClientAsLoader() 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); cache.createRegion("root", attrs); testXml(cache); final Region ro = cache.getRegion("root"); assertSame(ro.getAttributes().getCacheLoader(), ro.getAttributes().getCacheWriter()); assertTrue(ro.getAttributes().getCacheLoader() 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()); }
public static void assertEquals(RegionAttributes ra1, RegionAttributes ra2) { assertEquals(ra1.getScope(), ra2.getScope()); assertEquals(ra1.getKeyConstraint(), ra2.getKeyConstraint()); assertEquals(ra1.getValueConstraint(), ra2.getValueConstraint()); assertEquals(ra1.getCacheListener(), ra2.getCacheListener()); assertEquals(ra1.getCacheWriter(), ra2.getCacheWriter()); assertEquals(ra1.getCacheLoader(), ra2.getCacheLoader()); assertEquals(ra1.getStatisticsEnabled(), ra2.getStatisticsEnabled()); assertEquals(ra1.getConcurrencyLevel(), ra2.getConcurrencyLevel()); assertEquals(ra1.getInitialCapacity(), ra2.getInitialCapacity()); assertTrue(ra1.getLoadFactor() == ra2.getLoadFactor()); assertEquals(ra1.getEarlyAck(), ra2.getEarlyAck()); assertEquals(ra1.isDiskSynchronous(), ra2.isDiskSynchronous()); assertEquals(ra1.getDiskStoreName(), ra2.getDiskStoreName()); }
public static void assertEquals(RegionAttributes ra1, RegionAttributes ra2) { assertEquals(ra1.getScope(), ra2.getScope()); assertEquals(ra1.getKeyConstraint(), ra2.getKeyConstraint()); assertEquals(ra1.getValueConstraint(), ra2.getValueConstraint()); assertEquals(ra1.getCacheListener(), ra2.getCacheListener()); assertEquals(ra1.getCacheWriter(), ra2.getCacheWriter()); assertEquals(ra1.getCacheLoader(), ra2.getCacheLoader()); assertEquals(ra1.getStatisticsEnabled(), ra2.getStatisticsEnabled()); assertEquals(ra1.getConcurrencyLevel(), ra2.getConcurrencyLevel()); assertEquals(ra1.getInitialCapacity(), ra2.getInitialCapacity()); assertTrue(ra1.getLoadFactor() == ra2.getLoadFactor()); assertEquals(ra1.getEarlyAck(), ra2.getEarlyAck()); assertEquals(ra1.isDiskSynchronous(), ra2.isDiskSynchronous()); assertEquals(ra1.getDiskStoreName(), ra2.getDiskStoreName()); }