private static LocalRegion createOwner(boolean withConcurrencyChecks) { LocalRegion owner = mock(LocalRegion.class); CachePerfStats cachePerfStats = mock(CachePerfStats.class); when(owner.getCachePerfStats()).thenReturn(cachePerfStats); when(owner.getEvictionAttributes()).thenReturn(evictionAttributes); when(owner.getConcurrencyChecksEnabled()).thenReturn(withConcurrencyChecks); when(owner.getDataPolicy()).thenReturn(DataPolicy.REPLICATE); doThrow(EntryNotFoundException.class).when(owner).checkEntryNotFound(any()); return owner; }
@Retained Object nonTXbasicGetValueInVM(KeyInfo keyInfo) { RegionEntry regionEntry = this.entries.getEntry(keyInfo.getKey()); if (regionEntry == null) { checkEntryNotFound(keyInfo.getKey()); } // OFFHEAP returned to callers Object value = regionEntry.getValueInVM(this); if (Token.isRemoved(value)) { checkEntryNotFound(keyInfo.getKey()); } if (value == Token.NOT_AVAILABLE) { return null; } return value; }
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); } }
@Override protected boolean operateOnRegion(ClusterDistributionManager dm, LocalRegion r, long startTime) throws RemoteOperationException { r.waitOnInitialization(); VersionTag<?> tag; try { RegionEntry re = r.getRegionEntry(key); if (re == null) { if (logger.isTraceEnabled(LogMarker.DM_VERBOSE)) { logger.trace(LogMarker.DM_VERBOSE, "RemoteFetchVersionMessage did not find entry for key:{}", key); } r.checkEntryNotFound(key); } tag = re.getVersionStamp().asVersionTag(); if (logger.isTraceEnabled(LogMarker.DM_VERBOSE)) { logger.trace("RemoteFetchVersionMessage for key:{} returning tag:{}", key, tag); } FetchVersionReplyMessage.send(getSender(), processorId, tag, dm); } catch (EntryNotFoundException e) { sendReply(getSender(), getProcessorId(), dm, new ReplyException(e), r, startTime); } return false; }
@Override protected boolean operateOnRegion(ClusterDistributionManager dm, LocalRegion r, long startTime) throws RemoteOperationException { r.waitOnInitialization(); // bug #43371 - accessing a region before it's initialized EntrySnapshot val; try { final KeyInfo keyInfo = r.getKeyInfo(key); Region.Entry<?, ?> re = r.getDataView().getEntry(keyInfo, r, true); if (re == null) { r.checkEntryNotFound(key); } NonLocalRegionEntry nlre = new NonLocalRegionEntry(re, r); LocalRegion dataReg = r.getDataRegionForRead(keyInfo); val = new EntrySnapshot(nlre, dataReg, r, false); FetchEntryReplyMessage.send(getSender(), getProcessorId(), val, dm, null); } catch (TransactionException tex) { FetchEntryReplyMessage.send(getSender(), getProcessorId(), null, dm, new ReplyException(tex)); } catch (EntryNotFoundException enfe) { FetchEntryReplyMessage.send(getSender(), getProcessorId(), null, dm, new ReplyException( "entry not found", enfe)); } // Unless there was an exception thrown, this message handles sending the // response return false; }
owner.checkEntryNotFound(event.getKey());
owner.checkEntryNotFound(event.getKey());