use of org.apache.geode.internal.cache.RegionEntry 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.RegionEntry in project geode by apache.
the class MemoryIndexStoreJUnitTest method testAddMappingAddsToBackingMap.
@Test
public void testAddMappingAddsToBackingMap() throws Exception {
RegionEntry mockEntry1 = mockEntries[0];
RegionEntry mockEntry2 = mockEntries[1];
store.addMapping("1", mockEntry1);
store.addMapping("2", mockEntry2);
assertEquals(2, numObjectsInStore(store));
assertTrue(objectContainedIn(store, mockEntry1));
assertTrue(objectContainedIn(store, mockEntry2));
}
use of org.apache.geode.internal.cache.RegionEntry in project geode by apache.
the class ServerResponseMatrix method checkForValidStateAfterNotification.
public static boolean checkForValidStateAfterNotification(LocalRegion region, Object key, int operation) {
// 4 nonexistent/destroyed , valid , invalid,local-invalid ,
// 4 create , update , invalidate, destroy
boolean[][] matrix = { { true, true, true, true }, { true, true, true, true }, { true, true, true, true }, { true, true, true, true } };
int cacheEntryState = -1;
RegionEntry re = region.entries.getEntry(key);
if (re == null) {
// nonexistent or destroyed
cacheEntryState = 0;
} else {
Token token = re.getValueAsToken();
if (token == Token.DESTROYED || token == Token.REMOVED_PHASE1 || token == Token.REMOVED_PHASE2 || token == Token.TOMBSTONE) {
// destroyed
cacheEntryState = 0;
} else if (token == Token.LOCAL_INVALID) {
// local-invalid
cacheEntryState = 3;
} else if (token == Token.INVALID) {
// invalid
cacheEntryState = 2;
} else {
// valid
cacheEntryState = 1;
}
}
int notificationState = -1;
switch(operation) {
case MessageType.LOCAL_CREATE:
notificationState = 0;
break;
case MessageType.LOCAL_UPDATE:
notificationState = 1;
break;
case MessageType.LOCAL_INVALIDATE:
notificationState = 2;
break;
case MessageType.LOCAL_DESTROY:
notificationState = 3;
break;
}
return matrix[cacheEntryState][notificationState];
}
use of org.apache.geode.internal.cache.RegionEntry in project geode by apache.
the class ServerResponseMatrix method checkForValidStateAfterRegisterInterest.
public static boolean checkForValidStateAfterRegisterInterest(LocalRegion region, Object key, Object serverValue) {
int cacheEntryState = -1;
RegionEntry re = region.entries.getEntry(key);
if (re == null) {
// nonexistent
cacheEntryState = 0;
} else {
Token token = re.getValueAsToken();
if (token == Token.DESTROYED) {
// destroyed
cacheEntryState = 3;
} else if (token == Token.INVALID) {
// invalid
cacheEntryState = 2;
} else {
// valid
cacheEntryState = 1;
}
}
// A matrix During register interest response processing
// 4 nonexistent, valid , invalid,destroyed
// 2 invalid, valid
boolean[][] matrix = { { true, true }, { false, false }, { true, true }, { true, true } };
// invalid
int registerInterstResState = 0;
if (serverValue != null) {
// valid
registerInterstResState = 1;
}
return matrix[cacheEntryState][registerInterstResState];
}
use of org.apache.geode.internal.cache.RegionEntry in project geode by apache.
the class RangeIndex method dump.
public String dump() {
StringBuilder sb = new StringBuilder(toString()).append(" {\n");
sb.append("Null Values\n");
Iterator nI = nullMappedEntries.entrySet().iterator();
while (nI.hasNext()) {
Map.Entry mapEntry = (Map.Entry) nI.next();
RegionEntry e = (RegionEntry) mapEntry.getKey();
Object value = mapEntry.getValue();
sb.append(" RegionEntry.key = ").append(e.getKey());
sb.append(" Value.type = ").append(value.getClass().getName());
if (value instanceof Collection) {
sb.append(" Value.size = ").append(((Collection) value).size());
}
sb.append("\n");
}
sb.append(" -----------------------------------------------\n");
sb.append("Undefined Values\n");
Iterator uI = undefinedMappedEntries.entrySet().iterator();
while (uI.hasNext()) {
Map.Entry mapEntry = (Map.Entry) uI.next();
RegionEntry e = (RegionEntry) mapEntry.getKey();
Object value = mapEntry.getValue();
sb.append(" RegionEntry.key = ").append(e.getKey());
sb.append(" Value.type = ").append(value.getClass().getName());
if (value instanceof Collection) {
sb.append(" Value.size = ").append(((Collection) value).size());
}
sb.append("\n");
}
sb.append(" -----------------------------------------------\n");
Iterator i1 = this.valueToEntriesMap.entrySet().iterator();
while (i1.hasNext()) {
Map.Entry indexEntry = (Map.Entry) i1.next();
sb.append(" Key = ").append(indexEntry.getKey()).append("\n");
sb.append(" Value Type = ").append(" ").append(indexEntry.getValue().getClass().getName()).append("\n");
if (indexEntry.getValue() instanceof Map) {
sb.append(" Value Size = ").append(" ").append(((Map) indexEntry.getValue()).size()).append("\n");
}
Iterator i2 = ((RegionEntryToValuesMap) indexEntry.getValue()).entrySet().iterator();
while (i2.hasNext()) {
Map.Entry mapEntry = (Map.Entry) i2.next();
RegionEntry e = (RegionEntry) mapEntry.getKey();
Object value = mapEntry.getValue();
sb.append(" RegionEntry.key = ").append(e.getKey());
sb.append(" Value.type = ").append(value.getClass().getName());
if (value instanceof Collection) {
sb.append(" Value.size = ").append(((Collection) value).size());
}
sb.append("\n");
// sb.append(" Value.type = ").append(value).append("\n");
}
sb.append(" -----------------------------------------------\n");
}
sb.append("}// Index ").append(getName()).append(" end");
return sb.toString();
}
Aggregations