use of com.hazelcast.internal.iteration.IterationPointer in project hazelcast by hazelcast.
the class MapFetchEntriesOperation method readInternal.
@Override
protected void readInternal(ObjectDataInput in) throws IOException {
super.readInternal(in);
fetchSize = in.readInt();
int pointersCount = in.readInt();
pointers = new IterationPointer[pointersCount];
for (int i = 0; i < pointersCount; i++) {
pointers[i] = new IterationPointer(in.readInt(), in.readInt());
}
}
use of com.hazelcast.internal.iteration.IterationPointer in project hazelcast by hazelcast.
the class MapFetchEntriesOperation method writeInternal.
@Override
protected void writeInternal(ObjectDataOutput out) throws IOException {
super.writeInternal(out);
out.writeInt(fetchSize);
out.writeInt(pointers.length);
for (IterationPointer pointer : pointers) {
out.writeInt(pointer.getIndex());
out.writeInt(pointer.getSize());
}
}
use of com.hazelcast.internal.iteration.IterationPointer in project hazelcast by hazelcast.
the class MapFetchKeysOperation method writeInternal.
@Override
protected void writeInternal(ObjectDataOutput out) throws IOException {
super.writeInternal(out);
out.writeInt(fetchSize);
out.writeInt(pointers.length);
for (IterationPointer pointer : pointers) {
out.writeInt(pointer.getIndex());
out.writeInt(pointer.getSize());
}
}
use of com.hazelcast.internal.iteration.IterationPointer in project hazelcast by hazelcast.
the class ResultSegment method writeData.
@Override
public void writeData(ObjectDataOutput out) throws IOException {
out.writeObject(result);
out.writeInt(pointers.length);
for (IterationPointer pointer : pointers) {
out.writeInt(pointer.getIndex());
out.writeInt(pointer.getSize());
}
}
use of com.hazelcast.internal.iteration.IterationPointer in project hazelcast by hazelcast.
the class CacheBasicAbstractTest method testInitableIterator.
@Test
public void testInitableIterator() {
int testSize = 3007;
SerializationService serializationService = new DefaultSerializationServiceBuilder().build();
for (int fetchSize = 1; fetchSize < 102; fetchSize++) {
SampleableConcurrentHashMap<Data, String> map = new SampleableConcurrentHashMap<>(1000);
for (int i = 0; i < testSize; i++) {
Integer key = i;
Data data = serializationService.toData(key);
String value1 = "value" + i;
map.put(data, value1);
}
IterationPointer[] pointers = { new IterationPointer(Integer.MAX_VALUE, -1) };
int total = 0;
int remaining = testSize;
while (remaining > 0 && pointers[pointers.length - 1].getIndex() > 0) {
int size = (Math.min(remaining, fetchSize));
List<Data> keys = new ArrayList<>(size);
pointers = map.fetchKeys(pointers, size, keys);
remaining -= keys.size();
total += keys.size();
}
assertEquals(testSize, total);
}
}
Aggregations