use of com.hazelcast.spi.serialization.SerializationService in project hazelcast by hazelcast.
the class EntryViewTest method testEntryViewSerialization.
@Test
public void testEntryViewSerialization() throws Exception {
ReplicatedMapEntryView entryView = createEntryView();
SerializationServiceBuilder serializationServiceBuilder = new DefaultSerializationServiceBuilder();
SerializationService serializationService = serializationServiceBuilder.build();
Data data = serializationService.toData(entryView);
ReplicatedMapEntryView deserialized = serializationService.toObject(data);
verifyFields(deserialized);
}
use of com.hazelcast.spi.serialization.SerializationService in project hazelcast by hazelcast.
the class WriteBehindQueueTest method createDelayedEntryList.
private List<DelayedEntry> createDelayedEntryList(int numberOfEntriesToCreate) {
final List<DelayedEntry> list = new ArrayList<DelayedEntry>(numberOfEntriesToCreate);
SerializationService ss1 = new DefaultSerializationServiceBuilder().build();
final long storeTime = Clock.currentTimeMillis();
for (int i = 0; i < numberOfEntriesToCreate; i++) {
final DelayedEntry<Data, Object> e = DelayedEntries.createWithoutValue(ss1.toData(i), storeTime, i);
list.add(e);
}
return list;
}
use of com.hazelcast.spi.serialization.SerializationService in project hazelcast by hazelcast.
the class ClientExecutorServiceProxy method submitToRandomInternal.
private <T> void submitToRandomInternal(Callable<T> task, ExecutionCallback<T> callback) {
checkNotNull(task, "task should not be null");
String uuid = getUUID();
int partitionId = randomPartitionId();
ClientMessage request = ExecutorServiceSubmitToPartitionCodec.encodeRequest(name, uuid, toData(task), partitionId);
ClientInvocationFuture f = invokeOnPartitionOwner(request, partitionId);
SerializationService serializationService = getContext().getSerializationService();
ClientDelegatingFuture<T> delegatingFuture = new ClientDelegatingFuture<T>(f, serializationService, SUBMIT_TO_PARTITION_DECODER);
delegatingFuture.andThen(callback);
}
use of com.hazelcast.spi.serialization.SerializationService 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;
}
use of com.hazelcast.spi.serialization.SerializationService in project hazelcast by hazelcast.
the class ClientExecutorServiceProxy method submitToKeyOwnerInternal.
private <T> void submitToKeyOwnerInternal(Callable<T> task, Object key, ExecutionCallback<T> callback) {
checkNotNull(task, "task should not be null");
String uuid = getUUID();
int partitionId = getPartitionId(key);
ClientMessage request = ExecutorServiceSubmitToPartitionCodec.encodeRequest(name, uuid, toData(task), partitionId);
ClientInvocationFuture f = invokeOnPartitionOwner(request, partitionId);
SerializationService serializationService = getContext().getSerializationService();
ClientDelegatingFuture<T> delegatingFuture = new ClientDelegatingFuture<T>(f, serializationService, SUBMIT_TO_PARTITION_DECODER);
delegatingFuture.andThen(callback);
}
Aggregations