/** * Returns true if the underlying region is partitioned and has redundancy. * * @return true if region is partitioned and redundant. */ public final boolean isRedundant() { if (this.regionAttributes.getDataPolicy().withPartitioning()) { return this.regionAttributes.getPartitionAttributes() .getRedundantCopies() > 0; } return false; }
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 final boolean isOffHeap() { final LocalRegion region = this.region; if (region != null) { return region.getEnableOffHeapMemory(); } return this.regionAttributes != null && this.regionAttributes.getEnableOffHeapMemory(); }
CompactMapRangeIndex(String indexName, Region region, String fromClause, String indexedExpression, String projectionAttributes, String origFromClause, String origIndxExpr, String[] defintions, boolean isAllKeys, String[] multiIndexingKeysPattern, Object[] mapKeys, IndexStatistics stats) { super(indexName, region, fromClause, indexedExpression, projectionAttributes, origFromClause, origIndxExpr, defintions, isAllKeys, multiIndexingKeysPattern, mapKeys, stats); RegionAttributes ra = region.getAttributes(); this.entryToMapKeyIndexKeyMap = new java.util.concurrent.ConcurrentHashMap(ra.getInitialCapacity(),ra.getLoadFactor(), ra.getConcurrencyLevel()); }
private boolean isEvictionOrExpirationSet(TableName refTable) { boolean isSet = false; Region<?, ?> refRegion = Misc.getRegionByPath(refTable .getFullTableNameAsRegionPath(), true); RegionAttributes<?, ?> rattrs = refRegion.getAttributes(); EvictionAction ea = rattrs.getEvictionAttributes().getAction(); if (!(ea == EvictionAction.NONE || ea == EvictionAction.OVERFLOW_TO_DISK) || rattrs.getEntryIdleTimeout().getTimeout() > 0 || rattrs.getEntryTimeToLive().getTimeout() > 0 || rattrs.getRegionIdleTimeout().getTimeout() > 0 || rattrs.getRegionTimeToLive().getTimeout() > 0) { isSet = true; } return isSet; }
/** * This method initializes the partitionedRegionDataStore for this PR. * * @param ra * Region attributes */ private void initializeDataStore(RegionAttributes ra) { this.dataStore = PartitionedRegionDataStore.createDataStore(cache, this, ra .getPartitionAttributes()); }
public void run2() throws CacheException { Region region = getRootRegion().getSubregion(name); ControlListener listener = (ControlListener) region.getAttributes().getCacheListeners()[0]; pause(1000); // we should not get any events but give some time for the server to send them assertEquals(0, listener.events.size()); } };
/** * Returns true if table is partitioned. */ public final boolean isPartitioned() { return this.regionAttributes.getDataPolicy().withPartitioning(); }
public String getCacheWriter() { Object o = this.ra.getCacheWriter(); if (o == null) { return ""; } else { return o.toString(); } }
public String getCacheLoader() { Object o = this.ra.getCacheLoader(); if (o == null) { return ""; } else { return o.toString(); } } public String getCacheWriter() {
public int getEntryTimeToLiveTimeLimit() { return this.ra.getEntryTimeToLive().getTimeout(); }
private void setDiskAttributes(BucketAttributesFactory factory) { factory.setDiskSynchronous(this.partitionedRegion.getAttributes().isDiskSynchronous()); factory.setDiskStoreName(this.partitionedRegion.getAttributes().getDiskStoreName()); }
protected synchronized void sendValueRequest(final InternalDistributedMember sender) { // send a message to this responder asking for the value // do this on the waiting pool in case the send blocks // Always attempt to send the message to fix bug 37149 RegionAttributes attrs = this.region.getAttributes(); NetSearchRequestMessage.sendMessage(this, this.regionName, this.key, sender, this.remainingTimeout, attrs.getEntryTimeToLive().getTimeout(), attrs.getEntryIdleTimeout().getTimeout()); // if it turns out that we can't send a message to this member then // our membership listener should save the day and schedule a send // to someone else or give up and report a failed search. }
public int getEntryIdleTimeoutTimeLimit() { return this.ra.getEntryIdleTimeout().getTimeout(); }
public void beforeRegionClear(Region rgn) { if (rgn.getAttributes().getEnableOffHeapMemory()) { if (rgn.getAttributes().getDataPolicy().isPartition()) { PartitionedRegion pr = (PartitionedRegion) rgn; int numBucketsHosted = pr.getRegionAdvisor().getAllBucketAdvisors() .size(); this.setNumExpectedRegionClearCalls(numBucketsHosted); } else { this.setNumExpectedRegionClearCalls(1); } } } }
/** Appends to a StringBuffer logging that describes a DiskSTore for the * given Region. * @param aRegion The Region possibly containing a DiskStore. * @param aStr The StringBuffer to append to. */ public static void logDiskStore(Region aRegion, StringBuffer aStr) { if (aRegion.getAttributes().getDiskStoreName() != null) { aStr.append(" diskStoreName " + aRegion.getAttributes().getDiskStoreName()); } }
public void testREPLICATE_PROXY() throws CacheException { CacheCreation cache = new CacheCreation(); RegionCreation root = (RegionCreation) cache.createRegion("replicateProxy", "REPLICATE_PROXY"); testXml(cache); GemFireCacheImpl c = (GemFireCacheImpl) getCache(); Region r = c.getRegion("replicateProxy"); assertNotNull(r); RegionAttributes ra = r.getAttributes(); assertEquals(DataPolicy.EMPTY, ra.getDataPolicy()); assertEquals(Scope.DISTRIBUTED_ACK, ra.getScope()); }
/** Test to make sure region attributes take */ public void testRegionAttributes() throws CacheException { // @todo for now just test concurrencyLevel, add tests for the rest AttributesFactory factory = new AttributesFactory(); factory.setConcurrencyLevel(60); factory.setConcurrencyChecksEnabled(true); factory.setScope(Scope.DISTRIBUTED_ACK); RegionAttributes attrs = factory.create(); String name = getUniqueName(); Region region = createRegion(name, attrs); assertEquals(60, region.getAttributes().getConcurrencyLevel()); assertTrue("expected concurrencyChecksEnabled to be true", region.getAttributes().getConcurrencyChecksEnabled()); }
public int getConcurrencyLevel() { return this.ra.getConcurrencyLevel(); }
public MemoryIndexStore(Region region, InternalIndexStatistics internalIndexStats) { this.region = region; RegionAttributes ra = region.getAttributes(); // Initialize the reverse-map if in-place modification is set by the // application. if (IndexManager.isObjectModificationInplace()) { this.entryToValuesMap = new ConcurrentHashMap<>(ra.getInitialCapacity(), ra.getLoadFactor(), ra.getConcurrencyLevel()); } this.internalIndexStats = internalIndexStats; }