AbstractRegionMap extends BaseRegionMap implements FocusedRegionMap, CacheModificationLock { @Override public boolean removeTombstone(RegionEntry re, VersionHolder version, boolean isEviction, boolean isScheduledTombstone) { boolean result = false; int destroyedVersion = version.getEntryVersion(); synchronized (this._getOwner().getSizeGuard()) { synchronized (re) { int entryVersion = re.getVersionStamp().getEntryVersion(); if (!re.isTombstone() || entryVersion > destroyedVersion) { if (logger.isTraceEnabled(LogMarker.TOMBSTONE_COUNT_VERBOSE)) { logger.trace(LogMarker.TOMBSTONE_COUNT_VERBOSE, "tombstone for {} was resurrected with v{}; destroyed version was v{}; count is {}; entryMap size is {}", re.getKey(), re.getVersionStamp().getEntryVersion(), destroyedVersion, this._getOwner().getTombstoneCount(), size()); } } else { if (logger.isTraceEnabled(LogMarker.TOMBSTONE_COUNT_VERBOSE)) { if (entryVersion == destroyedVersion) { logger.trace(LogMarker.TOMBSTONE_COUNT_VERBOSE, "removing tombstone for {} with v{} rv{}; count is {}", re.getKey(), destroyedVersion, version.getRegionVersion(), (this._getOwner().getTombstoneCount() - 1)); } else { logger.trace(LogMarker.TOMBSTONE_COUNT_VERBOSE, "removing entry (v{}) that is older than an expiring tombstone (v{} rv{}) for {}", entryVersion, destroyedVersion, version.getRegionVersion(), re.getKey()); } } try { re.setValue(_getOwner(), Token.REMOVED_PHASE2); if (removeTombstone(re)) { _getOwner().cancelExpiryTask(re); result = true; incEntryCount(-1); if (isScheduledTombstone) { _getOwner().incTombstoneCount(-1); } RegionVersionVector vector = _getOwner().getVersionVector(); if (vector != null) { vector.recordGCVersion(version.getMemberID(), version.getRegionVersion()); } } } catch (RegionClearedException e) { } catch (RegionDestroyedException e) { } } } } return result; } protected  AbstractRegionMap(InternalRegionArguments internalRegionArgs); @Override void changeOwner(LocalRegion r); @Override void setEntryFactory(RegionEntryFactory f); @Override RegionEntryFactory getEntryFactory(); @Override Attributes getAttributes(); LocalRegion _getOwner(); @Override ConcurrentMapWithReusableEntries<Object, Object> getCustomEntryConcurrentHashMap(); @Override Map<Object, Object> getEntryMap(); @Override void setEntryMap(ConcurrentMapWithReusableEntries<Object, Object> map); @Override int size(); @Override int sizeInVM(); @Override boolean isEmpty(); @Override Set keySet(); @Override @SuppressWarnings({"unchecked", "rawtypes"}) Collection<RegionEntry> regionEntries(); @SuppressWarnings({"unchecked", "rawtypes"}) @Override Collection<RegionEntry> regionEntriesInVM(); @Override boolean containsKey(Object key); @Override RegionEntry getEntry(Object key); @Override RegionEntry getEntry(EntryEventImpl event); @Override RegionEntry getEntryInVM(Object key); @Override RegionEntry putEntryIfAbsent(Object key, RegionEntry regionEntry); @Override RegionEntry getOperationalEntryInVM(Object key); @Override void removeEntry(Object key, RegionEntry regionEntry, boolean updateStat); @Override void removeEntry(Object key, RegionEntry regionEntry, boolean updateStat,
      EntryEventImpl event, final InternalRegion internalRegion); @Override void incEntryCount(int delta); @Override void close(BucketRegion bucketRegion); @Override Set<VersionSource> clear(RegionVersionVector rvv, BucketRegion bucketRegion); void lruUpdateCallback(boolean b); @Override void lruEntryCreate(RegionEntry e); @Override void lruEntryDestroy(RegionEntry regionEntry); @Override void lruEntryUpdate(RegionEntry e); @Override void decTxRefCount(RegionEntry e); @Override void processVersionTag(RegionEntry regionEntry, EntryEventImpl event); @Override void copyRecoveredEntries(RegionMap rm); @Override @Retained // Region entry may contain an off-heap value RegionEntry initRecoveredEntry(Object key, DiskEntry.RecoveredEntry value); @Override RegionEntry updateRecoveredEntry(Object key, DiskEntry.RecoveredEntry value); @Override boolean initialImagePut(final Object key, final long lastModified, Object newValue,
      final boolean wasRecovered, boolean deferLRUCallback,
      VersionTag entryVersion,
      InternalDistributedMember sender, boolean isSynchronizing); @Override boolean confirmEvictionDestroy(RegionEntry regionEntry); @Override boolean destroy(EntryEventImpl event, boolean inTokenMode, boolean duringRI,
      boolean cacheWrite, boolean isEviction, Object expectedOldValue, boolean removeRecoveredEntry); @Override void txApplyDestroy(Object key, TransactionId txId, TXRmtEvent txEvent,
      boolean inTokenMode, boolean inRI, Operation op, EventID eventId, Object aCallbackArgument,
      List<EntryEventImpl> pendingCallbacks, FilterRoutingInfo filterRoutingInfo,
      ClientProxyMembershipID bridgeContext, boolean isOriginRemote, TXEntryState txEntryState,
      VersionTag versionTag, long tailKey); @Override boolean invalidate(EntryEventImpl event, boolean invokeCallbacks, boolean forceNewEntry,
      boolean forceCallbacks); @Override void updateEntryVersion(EntryEventImpl event); @Override void txApplyInvalidate(Object key, Object newValue, boolean didDestroy, TransactionId txId,
      TXRmtEvent txEvent, boolean localOp, EventID eventId, Object aCallbackArgument,
      List<EntryEventImpl> pendingCallbacks, FilterRoutingInfo filterRoutingInfo,
      ClientProxyMembershipID bridgeContext, TXEntryState txEntryState, VersionTag versionTag,
      long tailKey); @Override void evictValue(Object key); @Override RegionEntry basicPut(EntryEventImpl event, final long unused, final boolean ifNew,
      final boolean ifOld, final Object expectedOldValue, // only non-null if ifOld
      final boolean requireOldValue, final boolean overwriteDestroyed); @Override void runWhileEvictionDisabled(Runnable r); @Override void txApplyPut(Operation putOp, Object key, Object nv, boolean didDestroy,
      TransactionId txId, TXRmtEvent txEvent, EventID eventId, Object aCallbackArgument,
      List<EntryEventImpl> pendingCallbacks, FilterRoutingInfo filterRoutingInfo,
      ClientProxyMembershipID bridgeContext, TXEntryState txEntryState, VersionTag versionTag,
      long tailKey); @Override void processAndGenerateTXVersionTag(EntryEventImpl callbackEvent, RegionEntry re,
      TXEntryState txEntryState); @Override void txRemoveOldIndexEntry(Operation op, RegionEntry entry); void dumpMap(); @Override void writeSyncIfPresent(Object key, Runnable runner); @Override void removeIfDestroyed(Object key); @Override void lockForCacheModification(InternalRegion owner, EntryEventImpl event); @Override void releaseCacheModificationLock(InternalRegion owner, EntryEventImpl event); @Override void lockRegionForAtomicTX(InternalRegion r); @Override void unlockRegionForAtomicTX(InternalRegion r); @Override boolean isTombstoneNotNeeded(RegionEntry re, int destroyedVersion); @Override boolean removeTombstone(RegionEntry re, VersionHolder version, boolean isEviction,
      boolean isScheduledTombstone); boolean verifyTombstoneCount(AtomicInteger numTombstones); @Override int getEntryOverhead(); @Override ARMLockTestHook getARMLockTestHook(); void setARMLockTestHook(ARMLockTestHook theHook);  }
@Test public void shouldBeMockable() throws Exception { AbstractRegionMap mockAbstractRegionMap = mock(AbstractRegionMap.class); RegionEntry mockRegionEntry = mock(RegionEntry.class); VersionHolder mockVersionHolder = mock(VersionHolder.class); when(mockAbstractRegionMap.removeTombstone(eq(mockRegionEntry), eq(mockVersionHolder), anyBoolean(), anyBoolean())).thenReturn(true); assertThat( mockAbstractRegionMap.removeTombstone(mockRegionEntry, mockVersionHolder, true, true)) .isTrue(); }