HCOLL-352 Changed garbage-free Chronicle-Map iterations API from old to new Contexts; Add SegmentContexts API

This commit is contained in:
leventov
2015-07-24 20:11:58 +03:00
parent 912a3cc2fc
commit 9fe1dab477
32 changed files with 196 additions and 231 deletions
@@ -257,12 +257,12 @@ public class ReplicationCheckingMap<K, V> implements ChronicleMap<K, V> {
}
@Override
public boolean forEachEntryWhile(Predicate<? super MapKeyContext<K, V>> predicate) {
public boolean forEachEntryWhile(Predicate<? super MapEntry<K, V>> predicate) {
return map1.forEachEntryWhile(predicate);
}
@Override
public void forEachEntry(Consumer<? super MapKeyContext<K, V>> action) {
public void forEachEntry(Consumer<? super MapEntry<K, V>> action) {
map1.forEachEntry(action);
}
@@ -295,6 +295,11 @@ public class ReplicationCheckingMap<K, V> implements ChronicleMap<K, V> {
throw new UnsupportedOperationException();
}
@Override
public MapSegmentContext<K, V, ?> segmentContext(int segmentIndex) {
throw new UnsupportedOperationException();
}
@Override
public File file() {
throw new UnsupportedOperationException();
@@ -68,8 +68,8 @@ public class SimpleMapOperationsListeningTest {
map.acquireUsing(3, value).addAtomicValue(1);
IntValue value2 = DataValueClasses.newDirectInstance(IntValue.class);
value2.setValue(5);
map.forEachEntry(c -> c.put(value2));
map.forEachEntry(c -> c.remove());
map.forEachEntry(e -> e.context().replaceValue(e, e.context().wrapValueAsData(value2)));
map.forEachEntry(e -> e.context().remove(e));
}
}
@@ -128,6 +128,11 @@ public class StatelessChronicleMapTest extends JSR166TestCase {
return d.queryContext(key);
}
@Override
public MapSegmentContext<K, V, ?> segmentContext(int segmentIndex) {
return d.segmentContext(segmentIndex);
}
@Override
public V get(Object key) {
return d.get(key);
@@ -217,12 +222,12 @@ public class StatelessChronicleMapTest extends JSR166TestCase {
}
@Override
public boolean forEachEntryWhile(Predicate<? super MapKeyContext<K, V>> predicate) {
public boolean forEachEntryWhile(Predicate<? super MapEntry<K, V>> predicate) {
return d.forEachEntryWhile(predicate);
}
@Override
public void forEachEntry(Consumer<? super MapKeyContext<K, V>> action) {
public void forEachEntry(Consumer<? super MapEntry<K, V>> action) {
d.forEachEntry(action);
}