Search in sources :

Example 6 with IterationPointer

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());
    }
}
Also used : IterationPointer(com.hazelcast.internal.iteration.IterationPointer)

Example 7 with IterationPointer

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());
    }
}
Also used : IterationPointer(com.hazelcast.internal.iteration.IterationPointer)

Example 8 with IterationPointer

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());
    }
}
Also used : IterationPointer(com.hazelcast.internal.iteration.IterationPointer)

Example 9 with IterationPointer

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());
    }
}
Also used : IterationPointer(com.hazelcast.internal.iteration.IterationPointer)

Example 10 with IterationPointer

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);
    }
}
Also used : DefaultSerializationServiceBuilder(com.hazelcast.internal.serialization.impl.DefaultSerializationServiceBuilder) SampleableConcurrentHashMap(com.hazelcast.internal.util.SampleableConcurrentHashMap) AtomicInteger(java.util.concurrent.atomic.AtomicInteger) IterationPointer(com.hazelcast.internal.iteration.IterationPointer) ArrayList(java.util.ArrayList) SerializationService(com.hazelcast.internal.serialization.SerializationService) Data(com.hazelcast.internal.serialization.Data) Test(org.junit.Test)

Aggregations

IterationPointer (com.hazelcast.internal.iteration.IterationPointer)37 Data (com.hazelcast.internal.serialization.Data)9 ClientMessage (com.hazelcast.client.impl.protocol.ClientMessage)4 ClientInvocation (com.hazelcast.client.impl.spi.impl.ClientInvocation)4 ClientInvocationFuture (com.hazelcast.client.impl.spi.impl.ClientInvocationFuture)4 AbstractMap (java.util.AbstractMap)4 ArrayList (java.util.ArrayList)4 MapOperationProvider (com.hazelcast.map.impl.operation.MapOperationProvider)3 Map (java.util.Map)3 CacheEntriesWithCursor (com.hazelcast.cache.impl.CacheEntriesWithCursor)2 HazelcastClientInstanceImpl (com.hazelcast.client.impl.clientside.HazelcastClientInstanceImpl)2 SampleableConcurrentHashMap (com.hazelcast.internal.util.SampleableConcurrentHashMap)2 MapEntriesWithCursor (com.hazelcast.map.impl.iterator.MapEntriesWithCursor)2 CacheKeysWithCursor (com.hazelcast.cache.impl.CacheKeysWithCursor)1 CacheOperationProvider (com.hazelcast.cache.impl.CacheOperationProvider)1 CacheIterateCodec (com.hazelcast.client.impl.protocol.codec.CacheIterateCodec)1 CacheIterateEntriesCodec (com.hazelcast.client.impl.protocol.codec.CacheIterateEntriesCodec)1 MapFetchEntriesCodec (com.hazelcast.client.impl.protocol.codec.MapFetchEntriesCodec)1 MapFetchKeysCodec (com.hazelcast.client.impl.protocol.codec.MapFetchKeysCodec)1 MapFetchWithQueryCodec (com.hazelcast.client.impl.protocol.codec.MapFetchWithQueryCodec)1