private void initialize(SearchLoadAndWriteProcessor processor, String theRegionName, int timeoutMS, CacheEvent theEvent, int actionType) { this.processorId = processor.processorId; this.regionName = theRegionName; this.timeoutMs = timeoutMS; this.event = theEvent; this.action = actionType; Assert.assertTrue(processor.region.getScope().isDistributed()); }
private void initialize(SearchLoadAndWriteProcessor processor, String theRegionName, Object theKey, Object callbackArgument, int timeoutMS, int ttlMS, int idleTimeMS) { this.processorId = processor.processorId; this.regionName = theRegionName; this.key = theKey; this.aCallbackArgument = callbackArgument; this.timeoutMs = timeoutMS; this.ttl = ttlMS; this.idleTime = idleTimeMS; Assert.assertTrue(processor.region.getScope().isDistributed()); }
void initialize(SearchLoadAndWriteProcessor processor, String theRegionName, Object theKey, int timeoutMS, int ttlMS, int idleTimeMS) { this.processorId = processor.processorId; this.regionName = theRegionName; this.key = theKey; this.timeoutMs = timeoutMS; this.ttl = ttlMS; this.idleTime = idleTimeMS; Assert.assertTrue(processor.region.getScope().isDistributed()); }
/** * Initialize the set of remote members whose memory state is critical. This is called when * registering using * {@link InternalResourceManager#addResourceListener(ResourceType, ResourceListener)}. It should * only be called once and very early in this region's lifetime. * * @param localMemoryIsCritical true if the local memory is in a critical state * @param criticalMembers set of members whose memory is in a critical state * @see ResourceManager#setCriticalHeapPercentage(float) and * ResourceManager#setCriticalOffHeapPercentage(float) * @since GemFire 6.0 */ public void initialCriticalMembers(boolean localMemoryIsCritical, Set<InternalDistributedMember> criticalMembers) { assert getScope().isLocal(); if (localMemoryIsCritical) { setMemoryThresholdReached(true); } }
@Override public void run() { try { for (int i = 0; i < numEntries; i++) { CCRegion.destroy("cckey" + i); boolean condition1 = !CCRegion.containsKey("cckey" + i); assertThat(condition1).describedAs("entry should not exist").isTrue(); boolean condition = !CCRegion.containsValueForKey("cckey" + i); assertThat(condition).describedAs("entry should not contain a value").isTrue(); } checkCCRegionTombstoneCount("after destroys in this vm ", numEntries); boolean condition = !CCRegion.containsValue(Token.TOMBSTONE); assertThat(condition).describedAs("region should not contain a tombstone").isTrue(); if (CCRegion.getScope().isDistributedNoAck()) { sendSerialMessageToAll(); // flush the ops } } catch (CacheException e) { fail("while performing destroy operations", e); } } });
private void doOpsLoop(int runTimeMs, boolean includeClear) { doOpsLoopNoFlush(runTimeMs, includeClear, true); if (CCRegion.getScope().isDistributedNoAck()) { sendSerialMessageToAll(); // flush the ops } }
private void initialize(SearchLoadAndWriteProcessor processor, String theRegionName, Object theKey, boolean multicast, int theTimeoutMs, int theTtl, int theIdleTime) { this.processorId = processor.processorId; this.regionName = theRegionName; setMulticast(multicast); this.key = theKey; this.timeoutMs = theTimeoutMs; this.ttl = theTtl; this.idleTime = theIdleTime; Assert.assertTrue(processor.region.getScope().isDistributed()); }
protected void checkIfReplicatedAndLocalDestroy(EntryEventImpl event) { // disallow local invalidation for replicated regions if (getScope().isDistributed() && getDataPolicy().withReplication() && !event.isDistributed() && !isUsedForSerialGatewaySenderQueue()) { throw new IllegalStateException( "Not allowed to do a local destroy on a replicated region"); } }
@Before public void setUp() { path = "path"; cache = mock(InternalCache.class); dm = mock(ClusterDistributionManager.class); region = mock(LocalRegion.class); when(dm.getCache()).thenReturn(cache); when(cache.getRegionByPath(path)).thenReturn(region); when(region.isInitialized()).thenReturn(true); when(region.getScope()).thenReturn(Scope.DISTRIBUTED_ACK); }
private TombstoneSweeper getSweeper(LocalRegion r) { if (r.getScope().isDistributed() && r.getServerProxy() == null && r.getDataPolicy().withReplication()) { return this.replicatedTombstoneSweeper; } else { return this.nonReplicatedTombstoneSweeper; } }
if (lclRgn.getScope().isLocal()) { if (isDebugEnabled) { logger.debug("local scope region, nothing to do");
protected TestableAbstractRegionMap(boolean withConcurrencyChecks, boolean isDistributedRegion, ConcurrentMapWithReusableEntries map, RegionEntryFactory factory, RegionEntry regionEntryForGetEntry) { super(null); this.regionEntryForGetEntry = regionEntryForGetEntry; LocalRegion owner = isDistributedRegion ? mock(DistributedRegion.class, RETURNS_DEEP_STUBS) : mock(LocalRegion.class); CachePerfStats cachePerfStats = mock(CachePerfStats.class); when(owner.getCachePerfStats()).thenReturn(cachePerfStats); when(owner.getConcurrencyChecksEnabled()).thenReturn(withConcurrencyChecks); when(owner.getDataPolicy()).thenReturn(DataPolicy.REPLICATE); when(owner.getScope()).thenReturn(Scope.LOCAL); when(owner.isInitialized()).thenReturn(true); doThrow(EntryNotFoundException.class).when(owner).checkEntryNotFound(any()); initialize(owner, new Attributes(), null, false); if (map != null) { setEntryMap(map); } if (factory != null) { setEntryFactory(factory); } }
LocalRegion lr = mock(LocalRegion.class); when(lr.getOffHeap()).thenReturn(true); when(lr.getScope()).thenReturn(Scope.DISTRIBUTED_ACK); Object key = "key"; StoredObject value = mock(StoredObject.class);
Scope scope = this.region.getScope(); if (localWriter != null) { doLocalWrite(localWriter, event, action);
/** * basicInvalidate is overridden in HARegion to abort expiry of Events which have key as Long , if * it is not able to destroy from availableIDs * * @param forceNewEntry true if we are a mirror and still in the initialization phase. Called from * InvalidateOperation.InvalidateMessage */ void basicInvalidate(final EntryEventImpl event, boolean invokeCallbacks, final boolean forceNewEntry) throws EntryNotFoundException { if (!event.isOriginRemote() && !event.isDistributed() && getScope().isDistributed() && getDataPolicy().withReplication() && invokeCallbacks) { // catches case where being called by (distributed) invalidateRegion throw new IllegalStateException( "Cannot do a local invalidate on a replicated region"); } if (hasSeenEvent(event)) { if (logger.isTraceEnabled(LogMarker.DM_VERBOSE)) { logger.trace(LogMarker.DM_VERBOSE, "LR.basicInvalidate: this cache has already seen this event {}", event); } if (this.getConcurrencyChecksEnabled() && event.getVersionTag() != null && !event.getVersionTag().isRecorded()) { getVersionVector().recordVersion((InternalDistributedMember) event.getDistributedMember(), event.getVersionTag()); } return; } discoverJTA(); getDataView().invalidateExistingEntry(event, invokeCallbacks, forceNewEntry); }
if (getLocalRegion().getScope().isGlobal() && (action.isDestroy() || action.isInvalidate())) { Lock lock = getLocalRegion().getDistributedLock(getCheckedRegionEntry().getKey()); lock.lock();
protected void setMemoryThresholdFlag(MemoryEvent event) { assert getScope().isLocal(); if (event.isLocal()) { if (event.getState().isCritical() && !event.getPreviousState().isCritical() && (event.getType() == ResourceType.HEAP_MEMORY || (event.getType() == ResourceType.OFFHEAP_MEMORY && getOffHeap()))) { // start rejecting operations setMemoryThresholdReached(true); } else if (!event.getState().isCritical() && event.getPreviousState().isCritical() && (event.getType() == ResourceType.HEAP_MEMORY || (event.getType() == ResourceType.OFFHEAP_MEMORY && getOffHeap()))) { setMemoryThresholdReached(false); } } }
&& ((getScope().isDistributed()) || hasServerProxy() || basicGetLoader() != null)) {