public String getCacheLoader() { Object o = this.ra.getCacheLoader(); if (o == null) { return ""; } else { return o.toString(); } } public String getCacheWriter() {
public String getCacheLoader() { Object o = this.ra.getCacheLoader(); if (o == null) { return ""; } else { return o.toString(); } } public String getCacheWriter() {
private GfxdCacheLoader getRowLoaderFromRegion(Region<?, ?> region) { Object ldr = region.getAttributes().getCacheLoader(); if (ldr instanceof GfxdCacheLoader) { return (GfxdCacheLoader)ldr; } throw new IllegalStateException("Expected a GfxdCacheLoader in region: " + region.getName()); }
private GfxdCacheLoader getRowLoaderFromRegion(Region<?, ?> region) { Object ldr = region.getAttributes().getCacheLoader(); if (ldr instanceof GfxdCacheLoader) { return (GfxdCacheLoader)ldr; } throw new IllegalStateException("Expected a GfxdCacheLoader in region: " + region.getName()); }
private GfxdCacheLoader getRowLoaderFromRegion(Region<?, ?> region) { Object ldr = region.getAttributes().getCacheLoader(); if (ldr instanceof GfxdCacheLoader) { return (GfxdCacheLoader)ldr; } throw new IllegalStateException("Expected a GfxdCacheLoader in region: " + region.getName()); }
public void run() { Cache cache = getCache(); Region region = cache.getRegion("region1"); PartitionRegionInfo details = PartitionRegionHelper.getPartitionRegionInfo(region); assertEquals(6, details.getCreatedBucketCount()); assertEquals(0,details.getActualRedundantCopies()); assertEquals(0,details.getLowRedundancyBucketCount()); assertEquals(2, details.getPartitionMemberInfo().size()); for(PartitionMemberInfo memberDetails: details.getPartitionMemberInfo()) { assertEquals(3, memberDetails.getBucketCount()); assertEquals(3, memberDetails.getPrimaryCount()); } //check to make sure that moving buckets didn't close the cache loader Bug40228Loader loader = (Bug40228Loader) cache.getRegion("region1").getAttributes().getCacheLoader(); assertFalse(loader.isClosed()); } };
public void run() { Cache cache = getCache(); Region region = cache.getRegion("region1"); PartitionRegionInfo details = PartitionRegionHelper.getPartitionRegionInfo(region); assertEquals(6, details.getCreatedBucketCount()); assertEquals(0,details.getActualRedundantCopies()); assertEquals(0,details.getLowRedundancyBucketCount()); assertEquals(2, details.getPartitionMemberInfo().size()); for(PartitionMemberInfo memberDetails: details.getPartitionMemberInfo()) { assertEquals(3, memberDetails.getBucketCount()); assertEquals(3, memberDetails.getPrimaryCount()); } //check to make sure that moving buckets didn't close the cache loader Bug40228Loader loader = (Bug40228Loader) cache.getRegion("region1").getAttributes().getCacheLoader(); assertFalse(loader.isClosed()); } };
public void run() { Cache cache = getCache(); Region region = cache.getRegion("region1"); PartitionRegionInfo details = PartitionRegionHelper.getPartitionRegionInfo(region); assertEquals(6, details.getCreatedBucketCount()); assertEquals(0,details.getActualRedundantCopies()); assertEquals(0,details.getLowRedundancyBucketCount()); assertEquals(2, details.getPartitionMemberInfo().size()); for(PartitionMemberInfo memberDetails: details.getPartitionMemberInfo()) { assertEquals(3, memberDetails.getBucketCount()); assertEquals(3, memberDetails.getPrimaryCount()); } //check to make sure that moving buckets didn't close the cache loader Bug40228Loader loader = (Bug40228Loader) cache.getRegion("region1").getAttributes().getCacheLoader(); assertFalse(loader.isClosed()); } };
public void run() { Cache cache = getCache(); Bug40228Loader loader = (Bug40228Loader) cache.getRegion("region1").getAttributes().getCacheLoader(); assertFalse(loader.isClosed()); //check to make sure that closing the PR closes the cache loader cache.getRegion("region1").close(); assertTrue(loader.isClosed()); } };
public void run() { Cache cache = getCache(); Bug40228Loader loader = (Bug40228Loader) cache.getRegion("region1").getAttributes().getCacheLoader(); assertFalse(loader.isClosed()); //check to make sure that closing the PR closes the cache loader cache.getRegion("region1").close(); assertTrue(loader.isClosed()); } };
public void run2() throws CacheException { Region region = getRootRegion().getSubregion(name); BridgeClient loader = (BridgeClient) region.getAttributes().getCacheLoader(); loader.close(); region.getAttributesMutator().setCacheLoader(null); } });
public static void removeGfxdCacheLoaderLocally( final GemFireContainer container) throws StandardException { @SuppressWarnings("unchecked") final Region<Object, Object> reg = container.getRegion(); final CacheLoader<Object, Object> prevLoader = reg.getAttributes() .getCacheLoader(); if (prevLoader == null) { return; } try { final AttributesMutator<Object, Object> mutator = reg .getAttributesMutator(); mutator.setCacheLoader(null); container.setLoaderInstalled(false); } catch (Exception ex) { throw StandardException.newException( SQLState.UNEXPECTED_EXCEPTION_FOR_LOADER, ex, container.getQualifiedTableName(), ex.toString()); } }
public static void removeGfxdCacheLoaderLocally( final GemFireContainer container) throws StandardException { @SuppressWarnings("unchecked") final Region<Object, Object> reg = container.getRegion(); final CacheLoader<Object, Object> prevLoader = reg.getAttributes() .getCacheLoader(); if (prevLoader == null) { return; } try { final AttributesMutator<Object, Object> mutator = reg .getAttributesMutator(); mutator.setCacheLoader(null); container.setLoaderInstalled(false); } catch (Exception ex) { throw StandardException.newException( SQLState.UNEXPECTED_EXCEPTION_FOR_LOADER, ex, container.getQualifiedTableName(), ex.toString()); } }
/** * 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()); }
public void testSetCacheLoader() throws CacheException, IOException { Cache c = createCache(); Region r1 = null; try { RegionFactory factory = c.createRegionFactory(REPLICATE_PROXY); CacheLoader cl = new MyCacheLoader(); r1 = factory.setCacheLoader(cl).create(this.r1Name); RegionAttributes ra = r1.getAttributes(); assertEquals(cl, ra.getCacheLoader()); } finally { cleanUpRegion(r1); } }
public void refreshCachedInfo(TableDescriptor td, DistributionDescriptor distributionDesc, Activation activation) throws StandardException { if (distributionDesc != null) { final RegionAttributes<?, ?> rattr = getRegionAttributes(); final CacheLoader<?, ?> ldr = rattr.getCacheLoader(); if (ldr != null) { ((GfxdCacheLoader)ldr).setTableDetails(td); } final PartitionAttributes<?, ?> pattrs = rattr.getPartitionAttributes(); if (pattrs != null) { final PartitionResolver<?, ?> pr = rattr.getPartitionAttributes() .getPartitionResolver(); if (pr != null && pr instanceof GfxdPartitionResolver) { final GfxdPartitionResolver spr = (GfxdPartitionResolver)pr; spr.setTableDetails(td, this); spr.setDistributionDescriptor(distributionDesc); spr.setColumnInfo(td, activation); } } } this.tableInfo.refreshCachedInfo(td, this); }
public void refreshCachedInfo(TableDescriptor td, DistributionDescriptor distributionDesc, Activation activation) throws StandardException { if (distributionDesc != null) { final RegionAttributes<?, ?> rattr = getRegionAttributes(); final CacheLoader<?, ?> ldr = rattr.getCacheLoader(); if (ldr != null) { ((GfxdCacheLoader)ldr).setTableDetails(td); } final PartitionAttributes<?, ?> pattrs = rattr.getPartitionAttributes(); if (pattrs != null) { final PartitionResolver<?, ?> pr = rattr.getPartitionAttributes() .getPartitionResolver(); if (pr != null && pr instanceof GfxdPartitionResolver) { final GfxdPartitionResolver spr = (GfxdPartitionResolver)pr; spr.setTableDetails(td, this); spr.setDistributionDescriptor(distributionDesc); spr.setColumnInfo(td, activation); } } } this.tableInfo.refreshCachedInfo(td, this); }
public void refreshCachedInfo(TableDescriptor td, DistributionDescriptor distributionDesc, Activation activation) throws StandardException { setDistributionDescriptor(distributionDesc); if (distributionDesc != null) { final RegionAttributes<?, ?> rattr = getRegionAttributes(); final CacheLoader<?, ?> ldr = rattr.getCacheLoader(); if (ldr != null) { ((GfxdCacheLoader)ldr).setTableDetails(td); } final PartitionAttributes<?, ?> pattrs = rattr.getPartitionAttributes(); if (pattrs != null) { final PartitionResolver<?, ?> pr = rattr.getPartitionAttributes() .getPartitionResolver(); if (pr instanceof GfxdPartitionResolver) { final GfxdPartitionResolver spr = (GfxdPartitionResolver)pr; spr.setTableDetails(td, this); spr.updateDistributionDescriptor(distributionDesc); spr.setColumnInfo(td, activation); } } } this.tableInfo.refreshCachedInfo(td, this); }
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()); }