Search in sources :

Example 31 with UnmodifiableLazyList

use of com.hazelcast.spi.impl.UnmodifiableLazyList in project hazelcast by hazelcast.

the class ClientMapProxy method valuesForPagingPredicate.

@SuppressWarnings("unchecked")
private Collection<V> valuesForPagingPredicate(Predicate predicate) {
    PagingPredicateImpl pagingPredicate = unwrapPagingPredicate(predicate);
    pagingPredicate.setIterationType(IterationType.VALUE);
    PagingPredicateHolder pagingPredicateHolder = PagingPredicateHolder.of(predicate, getSerializationService());
    ClientMessage request = MapValuesWithPagingPredicateCodec.encodeRequest(name, pagingPredicateHolder);
    ClientMessage response = invokeWithPredicate(request, predicate);
    MapValuesWithPagingPredicateCodec.ResponseParameters resultParameters = MapValuesWithPagingPredicateCodec.decodeResponse(response);
    SerializationService serializationService = getSerializationService();
    pagingPredicate.setAnchorList(resultParameters.anchorDataList.asAnchorList(serializationService));
    return (Collection<V>) new UnmodifiableLazyList(resultParameters.response, serializationService);
}
Also used : PagingPredicateHolder(com.hazelcast.client.impl.protocol.codec.holder.PagingPredicateHolder) SerializationService(com.hazelcast.internal.serialization.SerializationService) Collection(java.util.Collection) CollectionUtil.objectToDataCollection(com.hazelcast.internal.util.CollectionUtil.objectToDataCollection) UnmodifiableLazyList(com.hazelcast.spi.impl.UnmodifiableLazyList) ClientMessage(com.hazelcast.client.impl.protocol.ClientMessage) MapValuesWithPagingPredicateCodec(com.hazelcast.client.impl.protocol.codec.MapValuesWithPagingPredicateCodec) PagingPredicateImpl(com.hazelcast.query.impl.predicates.PagingPredicateImpl)

Example 32 with UnmodifiableLazyList

use of com.hazelcast.spi.impl.UnmodifiableLazyList in project hazelcast by hazelcast.

the class ClientTxnMultiMapProxy method remove.

@Override
public Collection<V> remove(Object key) {
    ClientMessage request = TransactionalMultiMapRemoveCodec.encodeRequest(name, getTransactionId(), getThreadId(), toData(key));
    ClientMessage response = invoke(request);
    List<Data> collection = TransactionalMultiMapRemoveCodec.decodeResponse(response);
    return new UnmodifiableLazyList(collection, getSerializationService());
}
Also used : Data(com.hazelcast.internal.serialization.Data) UnmodifiableLazyList(com.hazelcast.spi.impl.UnmodifiableLazyList) ClientMessage(com.hazelcast.client.impl.protocol.ClientMessage)

Example 33 with UnmodifiableLazyList

use of com.hazelcast.spi.impl.UnmodifiableLazyList in project hazelcast by hazelcast.

the class ListProxyImpl method subList.

@Override
public List<E> subList(int fromIndex, int toIndex) {
    ListSubOperation operation = new ListSubOperation(name, fromIndex, toIndex);
    SerializableList result = invoke(operation);
    List<Data> collection = result.getCollection();
    SerializationService serializationService = getNodeEngine().getSerializationService();
    return new UnmodifiableLazyList(collection, serializationService);
}
Also used : ListSubOperation(com.hazelcast.collection.impl.list.operations.ListSubOperation) SerializableList(com.hazelcast.spi.impl.SerializableList) SerializationService(com.hazelcast.internal.serialization.SerializationService) Data(com.hazelcast.internal.serialization.Data) UnmodifiableLazyList(com.hazelcast.spi.impl.UnmodifiableLazyList)

Example 34 with UnmodifiableLazyList

use of com.hazelcast.spi.impl.UnmodifiableLazyList in project hazelcast by hazelcast.

the class UnmodifiableLazyListTest method testIsEmpty_True.

@Test
public void testIsEmpty_True() {
    list = new UnmodifiableLazyList(Collections.emptyList(), serializationService);
    assertTrue(list.isEmpty());
}
Also used : UnmodifiableLazyList(com.hazelcast.spi.impl.UnmodifiableLazyList) ParallelJVMTest(com.hazelcast.test.annotation.ParallelJVMTest) QuickTest(com.hazelcast.test.annotation.QuickTest) Test(org.junit.Test)

Aggregations

UnmodifiableLazyList (com.hazelcast.spi.impl.UnmodifiableLazyList)34 ClientMessage (com.hazelcast.client.impl.protocol.ClientMessage)30 Data (com.hazelcast.internal.serialization.Data)9 Data (com.hazelcast.nio.serialization.Data)6 Nonnull (javax.annotation.Nonnull)4 SerializationService (com.hazelcast.internal.serialization.SerializationService)3 ArrayList (java.util.ArrayList)3 CollectionUtil.objectToDataCollection (com.hazelcast.internal.util.CollectionUtil.objectToDataCollection)2 SerializableList (com.hazelcast.spi.impl.SerializableList)2 SerializationService (com.hazelcast.spi.serialization.SerializationService)2 Collection (java.util.Collection)2 List (java.util.List)2 ListIterator (java.util.ListIterator)2 ListGetAllCodec (com.hazelcast.client.impl.protocol.codec.ListGetAllCodec)1 ListSubCodec (com.hazelcast.client.impl.protocol.codec.ListSubCodec)1 MapProjectCodec (com.hazelcast.client.impl.protocol.codec.MapProjectCodec)1 MapProjectWithPredicateCodec (com.hazelcast.client.impl.protocol.codec.MapProjectWithPredicateCodec)1 MapValuesCodec (com.hazelcast.client.impl.protocol.codec.MapValuesCodec)1 MapValuesWithPagingPredicateCodec (com.hazelcast.client.impl.protocol.codec.MapValuesWithPagingPredicateCodec)1 MapValuesWithPredicateCodec (com.hazelcast.client.impl.protocol.codec.MapValuesWithPredicateCodec)1