use of com.hazelcast.spi.Operation in project hazelcast by hazelcast.
the class AbstractInternalCacheProxy method replaceAsyncInternal.
<T> InternalCompletableFuture<T> replaceAsyncInternal(K key, V oldValue, V newValue, ExpiryPolicy expiryPolicy, boolean hasOldValue, boolean isGet, boolean withCompletionEvent) {
ensureOpen();
if (hasOldValue) {
validateNotNull(key, oldValue, newValue);
CacheProxyUtil.validateConfiguredTypes(cacheConfig, key, oldValue, newValue);
} else {
validateNotNull(key, newValue);
CacheProxyUtil.validateConfiguredTypes(cacheConfig, key, newValue);
}
Data keyData = serializationService.toData(key);
Data oldValueData = serializationService.toData(oldValue);
Data newValueData = serializationService.toData(newValue);
Operation operation;
if (isGet) {
operation = operationProvider.createGetAndReplaceOperation(keyData, newValueData, expiryPolicy, IGNORE_COMPLETION);
} else {
operation = operationProvider.createReplaceOperation(keyData, oldValueData, newValueData, expiryPolicy, IGNORE_COMPLETION);
}
return invoke(operation, keyData, withCompletionEvent);
}
use of com.hazelcast.spi.Operation in project hazelcast by hazelcast.
the class AbstractInternalCacheProxy method putIfAbsentAsyncInternal.
InternalCompletableFuture<Boolean> putIfAbsentAsyncInternal(K key, V value, ExpiryPolicy expiryPolicy, boolean withCompletionEvent) {
ensureOpen();
validateNotNull(key, value);
CacheProxyUtil.validateConfiguredTypes(cacheConfig, key, value);
Data keyData = serializationService.toData(key);
Data valueData = serializationService.toData(value);
Operation operation = operationProvider.createPutIfAbsentOperation(keyData, valueData, expiryPolicy, IGNORE_COMPLETION);
return invoke(operation, keyData, withCompletionEvent);
}
use of com.hazelcast.spi.Operation in project hazelcast by hazelcast.
the class AbstractInternalCacheProxy method putAsyncInternal.
<T> InternalCompletableFuture<T> putAsyncInternal(K key, V value, ExpiryPolicy expiryPolicy, boolean isGet, boolean withCompletionEvent) {
ensureOpen();
validateNotNull(key, value);
CacheProxyUtil.validateConfiguredTypes(cacheConfig, key, value);
Data keyData = serializationService.toData(key);
Data valueData = serializationService.toData(value);
Operation op = operationProvider.createPutOperation(keyData, valueData, expiryPolicy, isGet, IGNORE_COMPLETION);
return invoke(op, keyData, withCompletionEvent);
}
use of com.hazelcast.spi.Operation in project hazelcast by hazelcast.
the class ClusterWideIterator method fetch.
protected List fetch() {
final OperationService operationService = cacheProxy.getNodeEngine().getOperationService();
if (prefetchValues) {
Operation operation = cacheProxy.operationProvider.createEntryIteratorOperation(lastTableIndex, fetchSize);
final InternalCompletableFuture<CacheEntryIterationResult> f = operationService.invokeOnPartition(CacheService.SERVICE_NAME, operation, partitionIndex);
CacheEntryIterationResult iteratorResult = f.join();
if (iteratorResult != null) {
setLastTableIndex(iteratorResult.getEntries(), iteratorResult.getTableIndex());
return iteratorResult.getEntries();
}
} else {
Operation operation = cacheProxy.operationProvider.createKeyIteratorOperation(lastTableIndex, fetchSize);
final InternalCompletableFuture<CacheKeyIterationResult> f = operationService.invokeOnPartition(CacheService.SERVICE_NAME, operation, partitionIndex);
CacheKeyIterationResult iteratorResult = f.join();
if (iteratorResult != null) {
setLastTableIndex(iteratorResult.getKeys(), iteratorResult.getTableIndex());
return iteratorResult.getKeys();
}
}
return null;
}
use of com.hazelcast.spi.Operation in project hazelcast by hazelcast.
the class CacheProxy method updateCacheListenerConfigOnOtherNodes.
private void updateCacheListenerConfigOnOtherNodes(CacheEntryListenerConfiguration<K, V> cacheEntryListenerConfiguration, boolean isRegister) {
OperationService operationService = getNodeEngine().getOperationService();
Collection<Member> members = getNodeEngine().getClusterService().getMembers();
for (Member member : members) {
if (!member.localMember()) {
Operation op = new CacheListenerRegistrationOperation(getDistributedObjectName(), cacheEntryListenerConfiguration, isRegister);
operationService.invokeOnTarget(CacheService.SERVICE_NAME, op, member.getAddress());
}
}
}
Aggregations