use of org.apache.geode.internal.cache.LocalRegion.NonTXEntry in project geode by apache.
the class PdxStringQueryJUnitTest method makeREUpdateInProgress.
public void makeREUpdateInProgress() {
Iterator entryItr = r.entrySet().iterator();
while (entryItr.hasNext()) {
Region.Entry nonTxEntry = (Region.Entry) entryItr.next();
RegionEntry entry = ((NonTXEntry) nonTxEntry).getRegionEntry();
entry.setUpdateInProgress(true);
assertTrue(entry.isUpdateInProgress());
}
}
use of org.apache.geode.internal.cache.LocalRegion.NonTXEntry in project geode by apache.
the class QueryREUpdateInProgressJUnitTest method putREWithUpdateInProgressTrue.
private void putREWithUpdateInProgressTrue(String region) {
Region reg = CacheUtils.getRegion(region);
Portfolio[] values = createPortfoliosAndPositions(numOfEntries);
int i = 0;
for (Object val : values) {
reg.put(i, val);
i++;
}
// Set all RegionEntries to be updateInProgress.
Iterator entryItr = reg.entrySet().iterator();
while (entryItr.hasNext()) {
Region.Entry nonTxEntry = (Region.Entry) entryItr.next();
RegionEntry entry = ((NonTXEntry) nonTxEntry).getRegionEntry();
entry.setUpdateInProgress(true);
assertTrue(entry.isUpdateInProgress());
}
}
use of org.apache.geode.internal.cache.LocalRegion.NonTXEntry in project geode by apache.
the class RegionEntryFlagsJUnitTest method testUpdateInProgressFlag.
@Test
public void testUpdateInProgressFlag() {
Region region = CacheUtils.createRegion("testRegion", null, Scope.DISTRIBUTED_ACK);
// Put one entry in the region.
region.put(1, 1);
Set entries = region.entrySet();
assertEquals(1, entries.size());
Region.Entry nonTxEntry = (Entry) entries.iterator().next();
RegionEntry entry = ((NonTXEntry) nonTxEntry).getRegionEntry();
assertFalse(entry.isUpdateInProgress());
entry.setUpdateInProgress(true);
assertTrue(entry.isUpdateInProgress());
entry.setUpdateInProgress(false);
assertFalse(entry.isUpdateInProgress());
}
use of org.apache.geode.internal.cache.LocalRegion.NonTXEntry in project geode by apache.
the class RegionEntryFlagsJUnitTest method testNetSearchFlag.
@Test
public void testNetSearchFlag() {
Region region = CacheUtils.createRegion("testRegion", null, Scope.DISTRIBUTED_ACK);
// Put one entry in the region.
region.put(1, 1);
Set entries = region.entrySet();
assertEquals(1, entries.size());
Region.Entry nonTxEntry = (Entry) entries.iterator().next();
RegionEntry entry = ((NonTXEntry) nonTxEntry).getRegionEntry();
assertFalse(entry.getValueWasResultOfSearch());
entry.setValueResultOfSearch(true);
assertTrue(entry.getValueWasResultOfSearch());
entry.setValueResultOfSearch(false);
assertFalse(entry.getValueWasResultOfSearch());
}
use of org.apache.geode.internal.cache.LocalRegion.NonTXEntry in project geode by apache.
the class BaseCommand method appendNewRegisterInterestResponseChunk.
public static void appendNewRegisterInterestResponseChunk(LocalRegion region, VersionedObjectList values, Object riKeys, Set<Map.Entry> set, ServerConnection servConn) throws IOException {
for (Entry entry : set) {
if (entry instanceof Region.Entry) {
// local entries
VersionTag vt;
Object key;
Object value;
if (entry instanceof EntrySnapshot) {
vt = ((EntrySnapshot) entry).getVersionTag();
key = ((EntrySnapshot) entry).getRegionEntry().getKey();
value = ((EntrySnapshot) entry).getRegionEntry().getValue(null);
updateValues(values, key, value, vt);
} else {
VersionStamp vs = ((NonTXEntry) entry).getRegionEntry().getVersionStamp();
vt = vs == null ? null : vs.asVersionTag();
key = entry.getKey();
value = ((NonTXEntry) entry).getRegionEntry()._getValueRetain(region, true);
try {
updateValues(values, key, value, vt);
} finally {
OffHeapHelper.release(value);
}
}
} else {
// Map.Entry (remote entries)
List list = (List) entry.getValue();
Object value = list.get(0);
VersionTag tag = (VersionTag) list.get(1);
updateValues(values, entry.getKey(), value, tag);
}
if (values.size() == MAXIMUM_CHUNK_SIZE) {
// Send the chunk and clear the list
sendNewRegisterInterestResponseChunk(region, riKeys != null ? riKeys : "ALL_KEYS", values, false, servConn);
values.clear();
}
}
// for
}
Aggregations