Search in sources :

Example 91 with SerializationService

use of com.hazelcast.spi.serialization.SerializationService in project hazelcast by hazelcast.

the class ClientListProxy method iterator.

@Override
public Iterator<E> iterator() {
    ClientMessage request = ListIteratorCodec.encodeRequest(name);
    ClientMessage response = invokeOnPartition(request);
    ListIteratorCodec.ResponseParameters resultParameters = ListIteratorCodec.decodeResponse(response);
    List<Data> resultCollection = resultParameters.response;
    SerializationService serializationService = getContext().getSerializationService();
    return new UnmodifiableLazyList<E>(resultCollection, serializationService).iterator();
}
Also used : ListIteratorCodec(com.hazelcast.client.impl.protocol.codec.ListIteratorCodec) ListListIteratorCodec(com.hazelcast.client.impl.protocol.codec.ListListIteratorCodec) SerializationService(com.hazelcast.spi.serialization.SerializationService) Data(com.hazelcast.nio.serialization.Data) ClientMessage(com.hazelcast.client.impl.protocol.ClientMessage)

Example 92 with SerializationService

use of com.hazelcast.spi.serialization.SerializationService in project hazelcast by hazelcast.

the class ClientListProxy method subList.

@Override
public List<E> subList(int fromIndex, int toIndex) {
    ClientMessage request = ListSubCodec.encodeRequest(name, fromIndex, toIndex);
    ClientMessage response = invokeOnPartition(request);
    ListSubCodec.ResponseParameters resultParameters = ListSubCodec.decodeResponse(response);
    List<Data> resultCollection = resultParameters.response;
    SerializationService serializationService = getContext().getSerializationService();
    return new UnmodifiableLazyList<E>(resultCollection, serializationService);
}
Also used : ListSubCodec(com.hazelcast.client.impl.protocol.codec.ListSubCodec) SerializationService(com.hazelcast.spi.serialization.SerializationService) Data(com.hazelcast.nio.serialization.Data) UnmodifiableLazyList(com.hazelcast.spi.impl.UnmodifiableLazyList) ClientMessage(com.hazelcast.client.impl.protocol.ClientMessage)

Example 93 with SerializationService

use of com.hazelcast.spi.serialization.SerializationService in project hazelcast by hazelcast.

the class ClientExecutorServiceProxy method submitToTargetInternal.

private <T> void submitToTargetInternal(Callable<T> task, Address address, ExecutionCallback<T> callback) {
    checkNotNull(task, "task should not be null");
    String uuid = getUUID();
    ClientMessage request = ExecutorServiceSubmitToAddressCodec.encodeRequest(name, uuid, toData(task), address);
    ClientInvocationFuture f = invokeOnTarget(request, address);
    SerializationService serializationService = getContext().getSerializationService();
    ClientDelegatingFuture<T> delegatingFuture = new ClientDelegatingFuture<T>(f, serializationService, SUBMIT_TO_ADDRESS_DECODER);
    delegatingFuture.andThen(callback);
}
Also used : ClientDelegatingFuture(com.hazelcast.client.util.ClientDelegatingFuture) SerializationService(com.hazelcast.spi.serialization.SerializationService) ClientMessage(com.hazelcast.client.impl.protocol.ClientMessage) ClientInvocationFuture(com.hazelcast.client.spi.impl.ClientInvocationFuture)

Example 94 with SerializationService

use of com.hazelcast.spi.serialization.SerializationService in project hazelcast by hazelcast.

the class QueueContainer method setConfig.

public void setConfig(QueueConfig config, NodeEngine nodeEngine, QueueService service) {
    this.nodeEngine = nodeEngine;
    this.service = service;
    this.logger = nodeEngine.getLogger(QueueContainer.class);
    this.config = new QueueConfig(config);
    // init queue store.
    final QueueStoreConfig storeConfig = config.getQueueStoreConfig();
    final SerializationService serializationService = nodeEngine.getSerializationService();
    ClassLoader classLoader = nodeEngine.getConfigClassLoader();
    this.store = QueueStoreWrapper.create(name, storeConfig, serializationService, classLoader);
}
Also used : QueueStoreConfig(com.hazelcast.config.QueueStoreConfig) QueueConfig(com.hazelcast.config.QueueConfig) SerializationService(com.hazelcast.spi.serialization.SerializationService)

Example 95 with SerializationService

use of com.hazelcast.spi.serialization.SerializationService in project hazelcast by hazelcast.

the class AddIndexOperation method run.

@Override
public void run() throws Exception {
    Indexes indexes = mapContainer.getIndexes();
    Index index = indexes.addOrGetIndex(attributeName, ordered);
    final long now = getNow();
    final Iterator<Record> iterator = recordStore.iterator(now, false);
    SerializationService serializationService = getNodeEngine().getSerializationService();
    while (iterator.hasNext()) {
        final Record record = iterator.next();
        Data key = record.getKey();
        Object value = Records.getValueOrCachedValue(record, serializationService);
        QueryableEntry queryEntry = mapContainer.newQueryEntry(key, value);
        index.saveEntryIndex(queryEntry, null);
    }
}
Also used : SerializationService(com.hazelcast.spi.serialization.SerializationService) Index(com.hazelcast.query.impl.Index) Record(com.hazelcast.map.impl.record.Record) Data(com.hazelcast.nio.serialization.Data) Indexes(com.hazelcast.query.impl.Indexes) QueryableEntry(com.hazelcast.query.impl.QueryableEntry)

Aggregations

SerializationService (com.hazelcast.spi.serialization.SerializationService)120 Test (org.junit.Test)59 QuickTest (com.hazelcast.test.annotation.QuickTest)56 Data (com.hazelcast.nio.serialization.Data)54 DefaultSerializationServiceBuilder (com.hazelcast.internal.serialization.impl.DefaultSerializationServiceBuilder)46 InternalSerializationService (com.hazelcast.internal.serialization.InternalSerializationService)28 ParallelTest (com.hazelcast.test.annotation.ParallelTest)22 ClientMessage (com.hazelcast.client.impl.protocol.ClientMessage)18 HeapData (com.hazelcast.internal.serialization.impl.HeapData)17 Map (java.util.Map)15 ArrayList (java.util.ArrayList)12 HashMap (java.util.HashMap)10 ClientInvocationFuture (com.hazelcast.client.spi.impl.ClientInvocationFuture)9 ClientDelegatingFuture (com.hazelcast.client.util.ClientDelegatingFuture)8 Node (com.hazelcast.instance.Node)7 SerializationConfig (com.hazelcast.config.SerializationConfig)6 ICacheService (com.hazelcast.cache.impl.ICacheService)5 ClientInvocation (com.hazelcast.client.spi.impl.ClientInvocation)5 Record (com.hazelcast.map.impl.record.Record)5 ICacheRecordStore (com.hazelcast.cache.impl.ICacheRecordStore)3