LocalRegion extends AbstractRegion implements LoaderHelperFactory,
    ResourceListener<MemoryEvent>, InternalPersistentRegion { @Override public int getLocalSize() { return getRegionMap().size() - tombstoneCount.get(); } protected  LocalRegion(String regionName, RegionAttributes attrs, LocalRegion parentRegion,
      InternalCache cache, InternalRegionArguments internalRegionArgs,
      StatisticsClock statisticsClock); protected  LocalRegion(String regionName, RegionAttributes attrs, LocalRegion parentRegion,
      InternalCache cache, InternalRegionArguments internalRegionArgs,
      InternalDataView internalDataView, StatisticsClock statisticsClock); @VisibleForTesting  LocalRegion(String regionName, RegionAttributes attrs, LocalRegion parentRegion,
      InternalCache cache, InternalRegionArguments internalRegionArgs,
      InternalDataView internalDataView, RegionMapConstructor regionMapConstructor,
      ServerRegionProxyConstructor serverRegionProxyConstructor,
      EntryEventFactory entryEventFactory, PoolFinder poolFinder,
      java.util.function.Function<LocalRegion, RegionPerfStats> regionPerfStatsFactory,
      StatisticsClock statisticsClock); @Override boolean isRegionInvalid(); @Override void setRegionInvalid(boolean regionInvalid); @Override StoppableCountDownLatch getInitializationLatchBeforeGetInitialImage(); @Override StoppableCountDownLatch getInitializationLatchAfterGetInitialImage(); void executeSynchronizedOperationOnCacheProfiles(Runnable operation); @Override CancelCriterion getCancelCriterion(); EventTracker getEventTracker(); @Override RegionVersionVector getVersionVector(); @Override RegionEntry getRegionEntry(Object key); @Override VersionTag getVersionTag(Object key); @Override ServerRegionProxy getServerProxy(); @Override boolean hasServerProxy(); void handleMarker(); @Override AttributesMutator getAttributesMutator(); @Override Region createSubregion(String subregionName, RegionAttributes aRegionAttributes); @Override InternalDistributedMember getMyId(); @Override VersionSource getVersionMember(); @Override Region createSubregion(String subregionName, RegionAttributes regionAttributes,
      InternalRegionArguments internalRegionArgs); @Override void create(Object key, Object value, Object aCallbackArgument); @Override boolean generateEventID(); @Override Object destroy(Object key, Object aCallbackArgument); @Override void destroyRegion(Object aCallbackArgument); @Override InternalDataView getDataView(); Object getDeserializedValue(RegionEntry regionEntry, final KeyInfo keyInfo,
      final boolean updateStats, boolean disableCopyOnRead, boolean preferCachedDeserializable,
      EntryEventImpl clientEvent, boolean returnTombstones, boolean retainResult); @Override Object get(Object key, Object aCallbackArgument, boolean generateCallbacks,
      EntryEventImpl clientEvent); Object get(Object key, Object aCallbackArgument, boolean generateCallbacks,
      boolean disableCopyOnRead, boolean preferCD, ClientProxyMembershipID requestingClient,
      EntryEventImpl clientEvent, boolean returnTombstones); @Retained Object getRetained(Object key, Object aCallbackArgument, boolean generateCallbacks,
      boolean disableCopyOnRead, ClientProxyMembershipID requestingClient,
      EntryEventImpl clientEvent, boolean returnTombstones); void recordMiss(final RegionEntry re, Object key); @Override boolean isCopyOnRead(); @Override String getFullPath(); @Override Region getParentRegion(); @Override Region getSubregion(String path); @Override void invalidateRegion(Object aCallbackArgument); @Override Object put(Object key, Object value, Object aCallbackArgument); @Override Region.Entry getEntry(Object key); @Override Region.Entry getEntry(Object key, boolean allowTombstones); Entry accessEntry(Object key, boolean updateStats); @Override boolean isThisRegionBeingClosedOrDestroyed(); @Override boolean isDestroyed(); @Override Set basicSubregions(boolean recursive); @Override Set subregions(boolean recursive); @Override Set entrySet(boolean recursive); Set basicEntries(boolean recursive); @VisibleForTesting Set testHookKeys(); Set keys(); Set keySet(boolean allowTombstones); @Override Collection values(); @Override Object getUserAttribute(); @Override void setUserAttribute(Object value); @Override boolean containsKey(Object key); @Override boolean containsTombstone(Object key); @Override boolean containsValueForKey(Object key); @Override RegionAttributes getAttributes(); @Override String getName(); @Override String getDisplayName(); int entryCount(); @Override int getRegionSize(); @Override DiskRegion getDiskRegion(); @Override DiskRegionView getDiskRegionView(); void evictValue(Object key); @Override void writeToDisk(); void forceFlush(); @Override Lock getRegionDistributedLock(); @Override Lock getDistributedLock(Object key); @Override void invalidate(Object key, Object aCallbackArgument); @Override void localDestroy(Object key, Object aCallbackArgument); @Override void localDestroyRegion(Object aCallbackArgument); @Override void close(); @Override void localInvalidate(Object key, Object aCallbackArgument); @Override void localInvalidateRegion(Object aCallbackArgument); @Override void initialize(InputStream snapshotInputStream, InternalDistributedMember imageTarget,
      InternalRegionArguments internalRegionArgs); void closeEntries(); Set<VersionSource> clearEntries(RegionVersionVector rvv); @Override void checkReadiness(); @Override void checkEntryNotFound(Object entryKey); @Override boolean cacheWriteBeforeDestroy(EntryEventImpl event, Object expectedOldValue); @Override boolean bridgeWriteBeforeDestroy(EntryEventImpl event, Object expectedOldValue); @Override void cacheWriteBeforePut(EntryEventImpl event, Set netWriteRecipients,
      CacheWriter localWriter, boolean requireOldValue, Object expectedOldValue); @Override CachePerfStats getCachePerfStats(); @Override CachePerfStats getRegionPerfStats(); void incTombstoneCount(int delta); @Override int getTombstoneCount(); @Override void scheduleTombstone(RegionEntry entry, VersionTag destroyedVersion); @Override void scheduleTombstone(RegionEntry entry, VersionTag destroyedVersion,
      boolean reschedule); @Override void rescheduleTombstone(RegionEntry entry, VersionTag version); @Override void unscheduleTombstone(RegionEntry entry); void expireTombstones(Map<VersionSource, Long> regionGCVersions, EventID eventID,
      FilterInfo clientRouting); void expireTombstoneKeys(Set<Object> tombstoneKeys); @Override Object getValueInVM(Object key); @VisibleForTesting Set testHookTXKeys(); @Override Object getValueOnDisk(Object key); @Override Object getValueInVMOrDiskWithoutFaultIn(Object key); @Override Object getValueOnDiskOrBuffer(Object key); @Override void saveSnapshot(OutputStream outputStream); @Override void loadSnapshot(InputStream inputStream); @Override void registerInterest(Object key); @Override void registerInterest(Object key, boolean isDurable); @Override void registerInterest(Object key, boolean isDurable, boolean receiveValues); void startRegisterInterest(); void finishRegisterInterest(); @Override void registerInterest(Object key, InterestResultPolicy policy); @Override void registerInterest(Object key, InterestResultPolicy policy, boolean isDurable); @Override void registerInterest(Object key, InterestResultPolicy policy, boolean isDurable,
      boolean receiveValues); @Override void registerInterestRegex(String regex); @Override void registerInterestRegex(String regex, boolean isDurable); @Override void registerInterestRegex(String regex, boolean isDurable, boolean receiveValues); @Override void registerInterestRegex(String regex, InterestResultPolicy policy); @Override void registerInterestRegex(String regex, InterestResultPolicy policy, boolean isDurable); @Override void registerInterestRegex(String regex, InterestResultPolicy policy, boolean isDurable,
      boolean receiveValues); @Override void unregisterInterest(Object key); @Override void unregisterInterestRegex(String regex); @Override List getInterestList(); Set getKeysWithInterest(int interestType, Object interestArg, boolean allowTombstones); @Override List<String> getInterestListRegex(); @Override Set keySetOnServer(); @Override boolean containsKeyOnServer(Object key); @Override int sizeOnServer(); @Override boolean isEmptyOnServer(); void refreshEntriesFromServerKeys(Connection con, List serverKeys,
      InterestResultPolicy interestResultPolicy); void clearKeysOfInterest(Object key, int interestType,
      InterestResultPolicy interestResultPolicy); @Override Region getSubregion(String path, boolean destroyedRegionOk); static InitializationLevel setThreadInitLevelRequirement(InitializationLevel level); @Override boolean checkForInitialization(); @Override void waitOnInitialization(); @Override void waitOnInitialization(StoppableCountDownLatch latch); void waitForData(); @Override RegionEntry basicGetEntry(Object key); void basicInvalidate(EntryEventImpl event); @Override DiskEntry initializeRecoveredEntry(Object key, DiskEntry.RecoveredEntry re); @Override DiskEntry updateRecoveredEntry(Object key, DiskEntry.RecoveredEntry re); @Override void copyRecoveredEntries(RegionMap rm); @Override void recordRecoveredGCVersion(VersionSource member, long gcVersion); @Override void recordRecoveredVersionHolder(VersionSource member, RegionVersionHolder versionHolder,
      boolean latestOplog); @Override void recordRecoveredVersionTag(VersionTag tag); @Override void setRVVTrusted(boolean rvvTrusted); Iterator<RegionEntry> getBestIterator(boolean includeValues); @Override void invokeInvalidateCallbacks(final EnumListenerEvent eventType,
      final EntryEventImpl event, final boolean callDispatchListenerEvent); @Override void txApplyInvalidate(Object key, Object newValue, boolean didDestroy,
      TransactionId transactionId, TXRmtEvent event, boolean localOp, EventID eventId,
      Object aCallbackArgument, List<EntryEventImpl> pendingCallbacks,
      FilterRoutingInfo filterRoutingInfo, ClientProxyMembershipID bridgeContext,
      TXEntryState txEntryState, VersionTag versionTag, long tailKey); @Override void txApplyPutHandleDidDestroy(Object key); @Override boolean basicPut(EntryEventImpl event, boolean ifNew, boolean ifOld,
      Object expectedOldValue, boolean requireOldValue); @Override void txApplyPut(Operation putOp, Object key, Object newValue, boolean didDestroy,
      TransactionId transactionId, TXRmtEvent event, EventID eventId, Object aCallbackArgument,
      List<EntryEventImpl> pendingCallbacks, FilterRoutingInfo filterRoutingInfo,
      ClientProxyMembershipID bridgeContext, TXEntryState txEntryState, VersionTag versionTag,
      long tailKey); @Override void txApplyPutPart2(RegionEntry regionEntry, Object key, long lastModified,
      boolean isCreate, boolean didDestroy, boolean clearConflict); boolean basicBridgeCreate(final Object key, final byte[] value, boolean isObject,
      Object callbackArg, final ClientProxyMembershipID client, boolean fromClient,
      EntryEventImpl clientEvent, boolean throwEntryExists); boolean basicBridgePut(Object key, Object value, byte[] deltaBytes, boolean isObject,
      Object callbackArg, ClientProxyMembershipID memberId, boolean fromClient,
      EntryEventImpl clientEvent); void basicBridgeClientUpdate(DistributedMember serverId, Object key, Object value,
      byte[] deltaBytes, boolean isObject, Object callbackArgument, boolean isCreate,
      boolean processedMarker, EntryEventImpl event, EventID eventID); void basicBridgeClientInvalidate(DistributedMember serverId, Object key,
      Object callbackArgument, boolean processedMarker, EventID eventID, VersionTag versionTag); void basicBridgeClientDestroy(DistributedMember serverId, Object key,
      Object callbackArgument, boolean processedMarker, EventID eventID, VersionTag versionTag); void basicBridgeClientClear(Object callbackArgument, boolean processedMarker); void basicBridgeDestroy(Object key, Object callbackArg, ClientProxyMembershipID memberId,
      boolean fromClient, EntryEventImpl clientEvent); void basicBridgeInvalidate(Object key, Object callbackArg,
      ClientProxyMembershipID memberId, boolean fromClient, EntryEventImpl clientEvent); void basicBridgeUpdateVersionStamp(Object key, Object callbackArg,
      ClientProxyMembershipID memberId, boolean fromClient, EntryEventImpl clientEvent); boolean virtualPut(final EntryEventImpl event, final boolean ifNew, final boolean ifOld,
      Object expectedOldValue, boolean requireOldValue, final long lastModified,
      final boolean overwriteDestroyed); @Override boolean virtualPut(final EntryEventImpl event, final boolean ifNew, final boolean ifOld,
      Object expectedOldValue, boolean requireOldValue, final long lastModified,
      final boolean overwriteDestroyed, boolean invokeCallbacks,
      boolean throwsConcurrentModification); @Override void checkIfAboveThreshold(final EntryEventImpl entryEvent); @Override MemoryThresholdInfo getAtomicThresholdInfo(); @Override Map<Object, Object> getEntryUserAttributes(); @Override long basicPutPart2(EntryEventImpl event, RegionEntry entry, boolean isInitialized,
      long lastModified, boolean clearConflict); @Override void notifyTimestampsToGateways(EntryEventImpl event); @Override void basicPutPart3(EntryEventImpl event, RegionEntry entry, boolean isInitialized,
      long lastModified, boolean invokeCallbacks, boolean ifNew, boolean ifOld,
      Object expectedOldValue, boolean requireOldValue); @Override void invokePutCallbacks(final EnumListenerEvent eventType, final EntryEventImpl event,
      final boolean callDispatchListenerEvent, boolean notifyGateways); Map<? extends DataSerializable, ? extends DataSerializable> getEventState(); @Override void generateAndSetVersionTag(InternalCacheEvent event, RegionEntry entry); @Override void recordEvent(InternalCacheEvent event); @Override boolean hasSeenEvent(EntryEventImpl event); @Override VersionTag findVersionTagForEvent(EventID eventId); VersionTag findVersionTagForClientBulkOp(EventID eventId); @Override boolean hasSeenEvent(EventID eventID); @Override void syncBulkOp(Runnable task, EventID eventId); void recordBulkOpStart(ThreadIdentifier membershipID, EventID eventID); boolean notifiesSerialGatewaySender(); @Override void postCreateRegion(); @Override void basicDestroy(final EntryEventImpl event, final boolean cacheWrite,
      Object expectedOldValue); @Override boolean mapDestroy(final EntryEventImpl event, final boolean cacheWrite,
      final boolean isEviction, Object expectedOldValue); @Override void handleDiskAccessException(DiskAccessException dae); @Override void basicDestroyBeforeRemoval(RegionEntry entry, EntryEventImpl event); @Override void basicDestroyPart2(RegionEntry re, EntryEventImpl event, boolean inTokenMode,
      boolean conflictWithClear, boolean duringRI, boolean invokeCallbacks); @Override void basicDestroyPart3(RegionEntry re, EntryEventImpl event, boolean inTokenMode,
      boolean duringRI, boolean invokeCallbacks, Object expectedOldValue); @Override void invokeDestroyCallbacks(final EnumListenerEvent eventType, final EntryEventImpl event,
      final boolean callDispatchListenerEvent, boolean notifyGateways); @Override void invokeTXCallbacks(final EnumListenerEvent eventType, final EntryEventImpl event,
      final boolean callDispatchListenerEvent); @Override void invokeTXCallbacks(final EnumListenerEvent eventType, final EntryEventImpl event,
      final boolean callDispatchListenerEvent,
      final boolean isLastEventInTransaction); @Override void txApplyDestroy(Object key, TransactionId rmtOrigin, TXRmtEvent event,
      boolean needTokensForGII, Operation op, EventID eventId, Object aCallbackArgument,
      List<EntryEventImpl> pendingCallbacks, FilterRoutingInfo filterRoutingInfo,
      ClientProxyMembershipID bridgeContext, boolean isOriginRemote, TXEntryState txEntryState,
      VersionTag versionTag, long tailKey); @Override void dispatchListenerEvent(EnumListenerEvent op, InternalCacheEvent event); @Override boolean isInitialized(); void acquireDestroyLock(); void releaseDestroyLock(); @Override void cleanupFailedInitialization(); @Override long updateStatsForPut(RegionEntry entry, long lastModified, boolean lruRecentUse); @Override void handleCacheClose(Operation operation); @Override void foreachRegionEntry(RegionEntryCallback callback); @Override DiskStoreImpl getDiskStore(); @Override ObjectSizer getObjectSizer(); @Override void addExpiryTaskIfAbsent(RegionEntry entry); @Override EntryExpiryTask getEntryExpiryTask(Object key); @Override RegionIdleExpiryTask getRegionIdleExpiryTask(); @Override RegionTTLExpiryTask getRegionTTLExpiryTask(); @Override void cancelExpiryTask(RegionEntry regionEntry); @Override ImageState getImageState(); @Override boolean lockGII(); @Override void unlockGII(); @Override Object basicGetEntryUserAttribute(Object entryKey); @VisibleForTesting TXStateProxy getTXState(); @Override TXId getTXId(); @Override TXEntryState createReadEntry(TXRegionState txRegionState, KeyInfo keyInfo,
      boolean createIfAbsent); @Override boolean txLRUStart(); @Override void txLRUEnd(); @Override void txDecRefCount(RegionEntry regionEntry); @Override void incRecentlyUsed(); @Override RegionMap getRegionMap(); @Override int size(); @Override int getLocalSize(); @Override boolean isEmpty(); @Override boolean containsValue(final Object value); @Override Set entrySet(); @Override Set keySet(); @Override Object remove(Object key); void basicBridgeDestroyRegion(Object callbackArg, final ClientProxyMembershipID client,
      boolean fromClient, EventID eventId); void basicBridgeClear(Object callbackArg, final ClientProxyMembershipID client,
      boolean fromClient, EventID eventId); void handleInterestEvent(InterestRegistrationEvent event); VersionedObjectList basicBridgePutAll(Map map, Map<Object, VersionTag> retryVersions,
      ClientProxyMembershipID memberId, EventID eventId, boolean skipCallbacks, Object callbackArg); VersionedObjectList basicBridgeRemoveAll(List<Object> keys,
      ArrayList<VersionTag> retryVersions, ClientProxyMembershipID memberId, EventID eventId,
      Object callbackArg); VersionedObjectList basicImportPutAll(Map map, boolean skipCallbacks); @Override void putAll(Map map, Object aCallbackArgument); @Override void putAll(Map map); @Override void removeAll(Collection keys); @Override void removeAll(Collection keys, Object aCallbackArgument); @Override VersionedObjectList basicRemoveAll(final Collection<Object> keys,
      final DistributedRemoveAllOperation removeAllOp, final List<VersionTag> retryVersions); void lockRVVForBulkOp(); void unlockRVVForBulkOp(); @VisibleForTesting DistributedPutAllOperation newPutAllOperation(Map<?, ?> map, Object callbackArg); @Override void postPutAllFireEvents(DistributedPutAllOperation putAllOp,
      VersionedObjectList successfulPuts); @Override void postRemoveAllFireEvents(DistributedRemoveAllOperation removeAllOp,
      VersionedObjectList successfulOps); @Override long postPutAllSend(DistributedPutAllOperation putAllOp,
      VersionedObjectList successfulPuts); @Override long postRemoveAllSend(DistributedRemoveAllOperation op,
      VersionedObjectList successfulOps); @Override boolean isUsedForPartitionedRegionAdmin(); boolean shouldSyncForCrashedMember(InternalDistributedMember id); @Override void forceRolling(); @Override File[] getDiskDirs(); @Override int[] getDiskDirSizes(); @Override boolean isUsedForPartitionedRegionBucket(); void removeCacheServiceProfile(String profileID); AbstractGatewaySender getSerialGatewaySender(); @Override PartitionedRegion getPartitionedRegion(); @Override boolean isUsedForMetaRegion(); @Override boolean isMetaRegionWithTransactions(); @Override boolean isInternalRegion(); @Override void addCacheServiceProfile(CacheServiceProfile profile); @Override LoaderHelper createLoaderHelper(Object key, Object callbackArgument,
      boolean netSearchAllowed, boolean netLoadAllowed, SearchLoadAndWriteProcessor searcher); @Override boolean isSecret(); @Override boolean shouldNotifyBridgeClients(); @Override boolean shouldDispatchListenerEvent(); @Override void cleanupForClient(CacheClientNotifier clientNotifier, ClientProxyMembershipID client); @Override FilterProfile getFilterProfile(); @Override SelectResults query(String predicate); ResultCollector executeFunction(final DistributedRegionFunctionExecutor execution,
      final Function function, final Object args, final ResultCollector rc, final Set filter,
      final ServerToClientFunctionResultSender sender); @Override void onEvent(MemoryEvent event); @Override int calculateValueSize(Object value); @Override int calculateRegionEntryValueSize(RegionEntry regionEntry); @Override void updateSizeOnPut(Object key, int oldSize, int newSize); @Override void updateSizeOnCreate(Object key, int newSize); @Override void updateSizeOnRemove(Object key, int oldSize); @Override int updateSizeOnEvict(Object key, int oldSize); @Override void updateSizeOnFaultIn(Object key, int newSize, int bytesOnDisk); @Override void initializeStats(long numEntriesInVM, long numOverflowOnDisk,
      long numOverflowBytesOnDisk); void removeCriticalMember(DistributedMember member); @Override void destroyRecoveredEntry(Object key); @Override boolean lruLimitExceeded(); @Override DiskEntry getDiskEntry(Object key); @Override LocalRegion getDataRegionForRead(KeyInfo entryKey); @Override LocalRegion getDataRegionForWrite(KeyInfo entryKey); InternalDataView getSharedDataView(); @Override DistributedMember getOwnerForKey(KeyInfo key); @Override KeyInfo getKeyInfo(Object key); KeyInfo getKeyInfo(Object key, Object callbackArg); @Override KeyInfo getKeyInfo(Object key, Object value, Object callbackArg); @Override void senderCreated(); @VisibleForTesting void dumpBackingMap(); Object putIfAbsent(Object key, Object value, Object callbackArgument); @Override Object putIfAbsent(Object key, Object value); @Override boolean remove(Object key, Object value); boolean remove(Object key, Object value, Object callbackArg); @Override boolean replace(Object key, Object oldValue, Object newValue); @Override Object replace(Object key, Object value); Object basicBridgePutIfAbsent(final Object key, Object value, boolean isObject,
      Object callbackArg, final ClientProxyMembershipID client, boolean fromClient,
      EntryEventImpl clientEvent); @Override KnownVersion[] getSerializationVersions(); boolean basicBridgeReplace(final Object key, Object expectedOldValue, Object value,
      boolean isObject, Object callbackArg, final ClientProxyMembershipID client,
      boolean fromClient, EntryEventImpl clientEvent); Object basicBridgeReplace(final Object key, Object value, boolean isObject,
      Object callbackArg, final ClientProxyMembershipID client, boolean fromClient,
      EntryEventImpl clientEvent); void basicBridgeRemove(Object key, Object expectedOldValue, Object callbackArg,
      ClientProxyMembershipID memberId, boolean fromClient, EntryEventImpl clientEvent); @Override long getVersionForMember(VersionSource member); IndexMap getIndexMap(String indexName, String indexedExpression, String fromClause); @Override void setInUseByTransaction(boolean value); @VisibleForTesting int testHookGetValuesInVM(); @VisibleForTesting int testHookGetValuesOnDisk(); @Override long getTotalEvictions(); @Override long getEvictionCounter(); @VisibleForTesting long getEvictionLimit(); @VisibleForTesting long getEvictionDestroys(); @Override EvictionController getEvictionController(); @Override void setEvictionMaximum(int maximum); @Override Statistics getEvictionStatistics(); @Override EvictionController getExistingController(InternalRegionArguments internalArgs); @Override String getNameForStats(); @Override Lock getClientMetaDataLock(); @VisibleForTesting boolean isMemoryThresholdReached(); @Override boolean isRegionCreateNotified(); @Override void setRegionCreateNotified(boolean notified); final RegionMap entries; static final String EXPIRY_MS_PROPERTY; @MakeNotStatic("This is modified in production code")
  static boolean ISSUE_CALLBACKS_TO_CACHE_OBSERVER; static final float DEFAULT_HEAPLRU_EVICTION_HEAP_PERCENTAGE; }
@Test public void getLocalSizeDoesNotThrowNullPointerExceptionDuringConstruction() { Function<LocalRegion, RegionPerfStats> regionPerfStatsFactory = localRegion -> { localRegion.getLocalSize(); return mock(RegionPerfStats.class); }; assertThatCode( () -> new LocalRegion("region", regionAttributes, null, cache, internalRegionArguments, internalDataView, regionMapConstructor, serverRegionProxyConstructor, entryEventFactory, poolFinder, regionPerfStatsFactory, disabledClock())) .doesNotThrowAnyException(); }