@Override protected void verifyDistributeUpdateEntryVersion(DistributedRegion region, EntryEventImpl event, int cnt) { region.basicUpdateEntryVersion(event); // verify the result if (cnt > 0) { verify(region, times(cnt)).distributeUpdateEntryVersion(eq(event)); } else { verify(region, never()).distributeUpdateEntryVersion(eq(event)); } }
protected DistributedRegion createAndDefineRegion(boolean isConcurrencyChecksEnabled, RegionAttributes ra, InternalRegionArguments ira, GemFireCacheImpl cache) { DistributedRegion region = new DistributedRegion("testRegion", ra, null, cache, ira); if (isConcurrencyChecksEnabled) { region.enableConcurrencyChecks(); } // since it is a real region object, we need to tell mockito to monitor it region = spy(region); doNothing().when(region).distributeUpdate(any(), anyLong(), anyBoolean(), anyBoolean(), any(), anyBoolean()); doNothing().when(region).distributeDestroy(any(), any()); doNothing().when(region).distributeInvalidate(any()); doNothing().when(region).distributeUpdateEntryVersion(any()); return region; }
@Override protected DistributedRegion createAndDefineRegion(boolean isConcurrencyChecksEnabled, RegionAttributes ra, InternalRegionArguments ira, GemFireCacheImpl cache) { DistributedRegion region = new DistributedRegion("testRegion", ra, null, cache, ira); if (isConcurrencyChecksEnabled) { region.enableConcurrencyChecks(); } // since it is a real region object, we need to tell mockito to monitor it region = spy(region); doNothing().when(region).distributeUpdate(any(), anyLong(), anyBoolean(), anyBoolean(), any(), anyBoolean()); doNothing().when(region).distributeDestroy(any(), any()); doNothing().when(region).distributeInvalidate(any()); doNothing().when(region).distributeUpdateEntryVersion(any()); return region; }
@Override void basicUpdateEntryVersion(EntryEventImpl event) throws EntryNotFoundException { InternalRegion internalRegion = event.getRegion(); AbstractRegionMap regionMap = (AbstractRegionMap) internalRegion.getRegionMap(); regionMap.lockForCacheModification(internalRegion, event); final boolean locked = internalRegion.lockWhenRegionIsInitializing(); try { try { if (!hasSeenEvent(event)) { super.basicUpdateEntryVersion(event); } } finally { if (!getConcurrencyChecksEnabled() || event.hasValidVersionTag()) { distributeUpdateEntryVersion(event); } } } finally { if (locked) { internalRegion.unlockWhenRegionIsInitializing(); } regionMap.releaseCacheModificationLock(internalRegion, event); } }