use of com.hazelcast.internal.serialization.SerializationService in project hazelcast by hazelcast.
the class ClientMapProxy method removeAsyncInternal.
protected InternalCompletableFuture<V> removeAsyncInternal(Object key) {
try {
Data keyData = toData(key);
ClientMessage request = MapRemoveCodec.encodeRequest(name, keyData, getThreadId());
ClientInvocationFuture future = invokeOnKeyOwner(request, keyData);
SerializationService ss = getSerializationService();
return new ClientDelegatingFuture<>(future, ss, MapRemoveCodec::decodeResponse);
} catch (Exception e) {
throw rethrow(e);
}
}
use of com.hazelcast.internal.serialization.SerializationService in project hazelcast by hazelcast.
the class ClientMapProxy method putAsyncInternal.
protected InternalCompletableFuture<V> putAsyncInternal(long ttl, TimeUnit timeunit, Long maxIdle, TimeUnit maxIdleUnit, Object key, Object value) {
try {
Data keyData = toData(key);
Data valueData = toData(value);
long ttlMillis = timeInMsOrOneIfResultIsZero(ttl, timeunit);
ClientMessage request;
if (maxIdle != null) {
request = MapPutWithMaxIdleCodec.encodeRequest(name, keyData, valueData, getThreadId(), ttlMillis, timeInMsOrOneIfResultIsZero(maxIdle, maxIdleUnit));
} else {
request = MapPutCodec.encodeRequest(name, keyData, valueData, getThreadId(), ttlMillis);
}
ClientInvocationFuture future = invokeOnKeyOwner(request, keyData);
SerializationService ss = getSerializationService();
return new ClientDelegatingFuture<>(future, ss, MapPutCodec::decodeResponse);
} catch (Exception e) {
throw rethrow(e);
}
}
use of com.hazelcast.internal.serialization.SerializationService 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);
}
use of com.hazelcast.internal.serialization.SerializationService in project hazelcast by hazelcast.
the class ClientMapProxy method submitToKeyInternal.
public <R> InternalCompletableFuture<R> submitToKeyInternal(Object key, EntryProcessor<K, V, R> entryProcessor) {
try {
Data keyData = toData(key);
ClientMessage request = MapSubmitToKeyCodec.encodeRequest(name, toData(entryProcessor), keyData, getThreadId());
ClientInvocationFuture future = invokeOnKeyOwner(request, keyData);
SerializationService ss = getSerializationService();
return new ClientDelegatingFuture(future, ss, MapSubmitToKeyCodec::decodeResponse);
} catch (Exception e) {
throw rethrow(e);
}
}
use of com.hazelcast.internal.serialization.SerializationService in project hazelcast by hazelcast.
the class CollectionMergeOperation method merge.
private Collection<CollectionItem> merge(CollectionContainer container, CollectionMergeTypes<Object> mergingValue, SplitBrainMergePolicy<Collection<Object>, CollectionMergeTypes<Object>, Collection<Object>> mergePolicy) {
SerializationService serializationService = getNodeEngine().getSerializationService();
mergingValue = (CollectionMergeTypes<Object>) serializationService.getManagedContext().initialize(mergingValue);
mergePolicy = (SplitBrainMergePolicy<Collection<Object>, CollectionMergeTypes<Object>, Collection<Object>>) serializationService.getManagedContext().initialize(mergePolicy);
Collection<CollectionItem> existingItems = container.getCollection();
CollectionMergeTypes<Object> existingValue = createMergingValueOrNull(serializationService, existingItems);
Collection<Object> newValues = mergePolicy.merge(mergingValue, existingValue);
if (isEmpty(newValues)) {
RemoteService service = getService();
service.destroyDistributedObject(name);
} else if (existingValue == null) {
createNewCollectionItems(container, existingItems, newValues, serializationService);
} else if (!newValues.equals(existingValue.getRawValue())) {
container.clear(false);
createNewCollectionItems(container, existingItems, newValues, serializationService);
}
return existingItems;
}
Aggregations