Search in sources :

Example 61 with Data

use of com.hazelcast.nio.serialization.Data in project hazelcast by hazelcast.

the class ClientQueryCacheEndToEndConstructor method createPublishAccumulatorWithIncludeValue.

private void createPublishAccumulatorWithIncludeValue(AccumulatorInfo info) {
    Data data = context.getSerializationService().toData(info.getPredicate());
    ClientMessage request = ContinuousQueryPublisherCreateWithValueCodec.encodeRequest(info.getMapName(), info.getCacheName(), data, info.getBatchSize(), info.getBufferSize(), info.getDelaySeconds(), info.isPopulate(), info.isCoalesce());
    InvokerWrapper invokerWrapper = context.getInvokerWrapper();
    ClientMessage response = (ClientMessage) invokerWrapper.invoke(request);
    Collection<Map.Entry<Data, Data>> result = ContinuousQueryPublisherCreateWithValueCodec.decodeResponse(response).response;
    populateWithValues(queryCache, result);
}
Also used : InvokerWrapper(com.hazelcast.map.impl.querycache.InvokerWrapper) Data(com.hazelcast.nio.serialization.Data) ClientMessage(com.hazelcast.client.impl.protocol.ClientMessage)

Example 62 with Data

use of com.hazelcast.nio.serialization.Data in project hazelcast by hazelcast.

the class ClientExecutorServiceProxy method retrieveResultFromMessage.

private Object retrieveResultFromMessage(ClientInvocationFuture f) {
    Object response;
    try {
        SerializationService serializationService = getClient().getSerializationService();
        Data data = ExecutorServiceSubmitToAddressCodec.decodeResponse(f.get()).response;
        response = serializationService.toObject(data);
    } catch (Exception e) {
        response = e;
    }
    return response;
}
Also used : SerializationService(com.hazelcast.spi.serialization.SerializationService) Data(com.hazelcast.nio.serialization.Data) TimeoutException(java.util.concurrent.TimeoutException) RejectedExecutionException(java.util.concurrent.RejectedExecutionException) HazelcastException(com.hazelcast.core.HazelcastException) ExecutionException(java.util.concurrent.ExecutionException)

Example 63 with Data

use of com.hazelcast.nio.serialization.Data in project hazelcast by hazelcast.

the class ClientListProxy method addAll.

@Override
public boolean addAll(int index, Collection<? extends E> c) {
    Preconditions.checkNotNull(c);
    Collection<Data> dataCollection = CollectionUtil.objectToDataCollection(c, getSerializationService());
    ClientMessage request = ListAddAllWithIndexCodec.encodeRequest(name, index, dataCollection);
    ClientMessage response = invokeOnPartition(request);
    ListAddAllWithIndexCodec.ResponseParameters resultParameters = ListAddAllWithIndexCodec.decodeResponse(response);
    return resultParameters.response;
}
Also used : ListAddAllWithIndexCodec(com.hazelcast.client.impl.protocol.codec.ListAddAllWithIndexCodec) Data(com.hazelcast.nio.serialization.Data) ClientMessage(com.hazelcast.client.impl.protocol.ClientMessage)

Example 64 with Data

use of com.hazelcast.nio.serialization.Data in project hazelcast by hazelcast.

the class ClientListProxy method addAll.

@Override
public boolean addAll(Collection<? extends E> c) {
    Preconditions.checkNotNull(c);
    Collection<Data> dataCollection = CollectionUtil.objectToDataCollection(c, getSerializationService());
    ClientMessage request = ListAddAllCodec.encodeRequest(name, dataCollection);
    ClientMessage response = invokeOnPartition(request);
    ListAddAllCodec.ResponseParameters resultParameters = ListAddAllCodec.decodeResponse(response);
    return resultParameters.response;
}
Also used : ListAddAllCodec(com.hazelcast.client.impl.protocol.codec.ListAddAllCodec) Data(com.hazelcast.nio.serialization.Data) ClientMessage(com.hazelcast.client.impl.protocol.ClientMessage)

Example 65 with Data

use of com.hazelcast.nio.serialization.Data in project hazelcast by hazelcast.

the class AbstractMapPartitionIterator method remove.

public void remove() {
    if (result == null || currentIndex < 0) {
        throw new IllegalStateException("Iterator.next() must be called before remove()!");
    }
    Data keyData = getKey(currentIndex);
    map.remove(keyData);
    currentIndex = -1;
}
Also used : Data(com.hazelcast.nio.serialization.Data)

Aggregations

Data (com.hazelcast.nio.serialization.Data)773 ClientMessage (com.hazelcast.client.impl.protocol.ClientMessage)140 Test (org.junit.Test)121 QuickTest (com.hazelcast.test.annotation.QuickTest)118 ParallelTest (com.hazelcast.test.annotation.ParallelTest)108 ArrayList (java.util.ArrayList)81 Map (java.util.Map)64 SerializationService (com.hazelcast.spi.serialization.SerializationService)54 HashMap (java.util.HashMap)54 NodeEngine (com.hazelcast.spi.NodeEngine)50 HashSet (java.util.HashSet)39 Address (com.hazelcast.nio.Address)28 AbstractMap (java.util.AbstractMap)28 Record (com.hazelcast.map.impl.record.Record)27 HazelcastInstance (com.hazelcast.core.HazelcastInstance)26 HeapData (com.hazelcast.internal.serialization.impl.HeapData)26 List (java.util.List)20 Future (java.util.concurrent.Future)20 CacheEventData (com.hazelcast.cache.impl.CacheEventData)19 Operation (com.hazelcast.spi.Operation)18