Search in sources :

Example 1 with MAX_BATCH_SIZE

use of com.hazelcast.ringbuffer.impl.RingbufferProxy.MAX_BATCH_SIZE in project hazelcast by hazelcast.

the class ClientRingbufferProxy method readManyAsync.

@Override
public ICompletableFuture<ReadResultSet<E>> readManyAsync(long startSequence, int minCount, int maxCount, IFunction<E, Boolean> filter) {
    checkSequence(startSequence);
    checkNotNegative(minCount, "minCount can't be smaller than 0");
    checkTrue(maxCount >= minCount, "maxCount should be equal or larger than minCount");
    checkTrue(minCount <= capacity(), "the minCount should be smaller than or equal to the capacity");
    checkTrue(maxCount <= MAX_BATCH_SIZE, "maxCount can't be larger than " + MAX_BATCH_SIZE);
    ClientMessage request = RingbufferReadManyCodec.encodeRequest(name, startSequence, minCount, maxCount, toData(filter));
    try {
        ClientInvocationFuture invocationFuture = new ClientInvocation(getClient(), request, partitionId).invoke();
        return new ClientDelegatingFuture<ReadResultSet<E>>(invocationFuture, getContext().getSerializationService(), readManyAsyncResponseDecoder);
    } catch (Exception e) {
        throw ExceptionUtil.rethrow(e);
    }
}
Also used : ClientDelegatingFuture(com.hazelcast.client.util.ClientDelegatingFuture) MAX_BATCH_SIZE(com.hazelcast.ringbuffer.impl.RingbufferProxy.MAX_BATCH_SIZE) ClientInvocation(com.hazelcast.client.spi.impl.ClientInvocation) ClientMessage(com.hazelcast.client.impl.protocol.ClientMessage) StaleSequenceException(com.hazelcast.ringbuffer.StaleSequenceException) ExecutionException(java.util.concurrent.ExecutionException) ClientInvocationFuture(com.hazelcast.client.spi.impl.ClientInvocationFuture)

Aggregations

ClientMessage (com.hazelcast.client.impl.protocol.ClientMessage)1 ClientInvocation (com.hazelcast.client.spi.impl.ClientInvocation)1 ClientInvocationFuture (com.hazelcast.client.spi.impl.ClientInvocationFuture)1 ClientDelegatingFuture (com.hazelcast.client.util.ClientDelegatingFuture)1 StaleSequenceException (com.hazelcast.ringbuffer.StaleSequenceException)1 MAX_BATCH_SIZE (com.hazelcast.ringbuffer.impl.RingbufferProxy.MAX_BATCH_SIZE)1 ExecutionException (java.util.concurrent.ExecutionException)1