public KeyInfo getKeyInfo(Object key, Object callbackArg) { return getKeyInfo(key, null, callbackArg); }
/** * @param rememberRead true if read should be remembered in a transaction * @since GemFire 5.5 */ private Object basicGetValueInVM(Object key, boolean rememberRead) throws EntryNotFoundException { return getDataView().getValueInVM(getKeyInfo(key), this, rememberRead); }
/** internally we often need to get an entry whether it is a tombstone or not */ public Region.Entry getEntry(Object key, boolean allowTombstones) { return getDataView().getEntry(getKeyInfo(key), this, allowTombstones); }
@Override public boolean containsValueForKey(Object key) { discoverJTA(); return getDataView().containsValueForKey(getKeyInfo(key), this); }
private void setupLocalRegion() { when(owner.getCachePerfStats()).thenReturn(cachePerfStats); when(owner.getCache()).thenReturn(mock(InternalCache.class)); when(owner.getMyId()).thenReturn(myId); when(owner.getKeyInfo(any(), any(), any())).thenReturn(keyInfo); }
private EntryEventImpl createEventForDestroy(LocalRegion lr) { when(lr.getKeyInfo(KEY)).thenReturn(new KeyInfo(KEY, null, null)); return EntryEventImpl.create(lr, Operation.DESTROY, KEY, false, null, true, false); }
@Override public boolean containsKey(Object key) { checkReadiness(); checkForNoAccess(); return getDataView().containsKey(getKeyInfo(key), this); }
/** * Just like getEntry but also updates the stats that get would have depending on a flag. See bug * 42410. Also skips discovering JTA * * @return the entry if it exists; otherwise null. */ public Entry accessEntry(Object key, boolean updateStats) { validateKey(key); checkReadiness(); checkForNoAccess(); if (updateStats) { return getDataView().accessEntry(getKeyInfo(key), this); } else { return getDataView().getEntry(getKeyInfo(key), this, false); } }
private EntryEventImpl createEventForInvalidate(LocalRegion lr) { when(lr.getKeyInfo(KEY)).thenReturn(new KeyInfo(KEY, null, null)); return EntryEventImpl.create(lr, Operation.INVALIDATE, KEY, false, null, true, false); }
@Override public Region.Entry getEntry(Object key) { validateKey(key); checkReadiness(); checkForNoAccess(); discoverJTA(); return getDataView().getEntry(getKeyInfo(key), this, false); }
@Test public void verifyToStringOutputHasRegionName() { // mock a region object LocalRegion region = mock(LocalRegion.class); String expectedRegionName = "ExpectedFullRegionPathName"; String value = "value1"; KeyInfo keyInfo = new KeyInfo(key, value, null); doReturn(expectedRegionName).when(region).getFullPath(); doReturn(keyInfo).when(region).getKeyInfo(any(), any(), any()); // create entry event for the region EntryEventImpl e = createEntryEvent(region, value); // The name of the region should be in the toString text String toStringValue = e.toString(); assertTrue("String " + expectedRegionName + " was not in toString text: " + toStringValue, toStringValue.indexOf(expectedRegionName) > 0); // verify that toString called getFullPath method of region object verify(region, times(1)).getFullPath(); }
@Override public boolean containsTombstone(Object key) { checkReadiness(); checkForNoAccess(); if (!this.getConcurrencyChecksEnabled()) { return false; } else { try { Entry entry = getDataView().getEntry(getKeyInfo(key), this, true); return entry != null && entry.getValue() == Token.TOMBSTONE; } catch (EntryDestroyedException ignore) { return true; } } }
Object cbArg = null; KeyInfo keyInfo = new KeyInfo(key, value, cbArg); when(lr.getKeyInfo(any(), any(), any())).thenReturn(keyInfo); processor.region = lr; EntryEventImpl event =
public static GatewaySenderEventImpl createGatewaySenderEvent(LocalRegion lr, Operation operation, Object key, Object value, long sequenceId, long shadowKey) throws Exception { when(lr.getKeyInfo(key, value, null)).thenReturn(new KeyInfo(key, null, null)); EntryEventImpl eei = EntryEventImpl.create(lr, operation, key, value, null, false, null); eei.setEventId(new EventID(new byte[16], 1l, sequenceId)); GatewaySenderEventImpl gsei = new GatewaySenderEventImpl(getEnumListenerEvent(operation), eei, null); gsei.setShadowKey(shadowKey); return gsei; }
Object val = null; try { KeyInfo keyInfo = r.getKeyInfo(key, cbArg); val = r.getDataView().getSerializedValue(r, keyInfo, false, this.context, null, false /* for replicate regions */);
@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; }
boolean isMiss = true; try { KeyInfo keyInfo = getKeyInfo(key, aCallbackArgument); Object value = getDataView().getDeserializedValue(keyInfo, this, true, disableCopyOnRead, preferCD, clientEvent, returnTombstones, retainResult, true);