use of com.hazelcast.spi.impl.operationservice.OperationService in project hazelcast by hazelcast.
the class CacheProxySupport method updateCacheListenerConfigOnOtherNodes.
protected 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());
}
}
}
use of com.hazelcast.spi.impl.operationservice.OperationService in project hazelcast by hazelcast.
the class CacheProxySupport method invokeInternal.
protected <T> T invokeInternal(Data keyData, EntryProcessor<K, V, T> entryProcessor, Object... arguments) throws EntryProcessorException {
Integer completionId = listenerCompleter.registerCompletionLatch(1);
Operation op = operationProvider.createEntryProcessorOperation(keyData, completionId, entryProcessor, arguments);
try {
OperationService operationService = getNodeEngine().getOperationService();
int partitionId = getPartitionId(keyData);
InvocationFuture<T> future = operationService.invokeOnPartition(getServiceName(), op, partitionId);
T safely = future.joinInternal();
listenerCompleter.waitCompletionLatch(completionId);
return safely;
} catch (CacheException ce) {
listenerCompleter.deregisterCompletionLatch(completionId);
throw ce;
} catch (Exception e) {
listenerCompleter.deregisterCompletionLatch(completionId);
throw new EntryProcessorException(e);
}
}
use of com.hazelcast.spi.impl.operationservice.OperationService in project hazelcast by hazelcast.
the class CacheProxySupport method clearInternal.
protected void clearInternal() {
try {
OperationService operationService = getNodeEngine().getOperationService();
OperationFactory operationFactory = operationProvider.createClearOperationFactory();
Map<Integer, Object> results = operationService.invokeOnAllPartitions(getServiceName(), operationFactory);
for (Object result : results.values()) {
if (result != null && result instanceof CacheClearResponse) {
Object response = ((CacheClearResponse) result).getResponse();
if (response instanceof Throwable) {
throw (Throwable) response;
}
}
}
} catch (Throwable t) {
throw rethrowAllowedTypeFirst(t, CacheException.class);
}
}
use of com.hazelcast.spi.impl.operationservice.OperationService in project hazelcast by hazelcast.
the class HazelcastServerCacheManager method enableStatisticManagementOnOtherNodes.
private void enableStatisticManagementOnOtherNodes(String cacheName, boolean statOrMan, boolean enabled) {
String cacheNameWithPrefix = getCacheNameWithPrefix(cacheName);
OperationService operationService = nodeEngine.getOperationService();
Collection<Future> futures = new ArrayList<Future>();
for (Member member : nodeEngine.getClusterService().getMembers()) {
if (!member.localMember()) {
CacheManagementConfigOperation op = new CacheManagementConfigOperation(cacheNameWithPrefix, statOrMan, enabled);
Future future = operationService.invokeOnTarget(CacheService.SERVICE_NAME, op, member.getAddress());
futures.add(future);
}
}
waitWithDeadline(futures, CacheProxyUtil.AWAIT_COMPLETION_TIMEOUT_SECONDS, TimeUnit.SECONDS);
}
use of com.hazelcast.spi.impl.operationservice.OperationService in project hazelcast by hazelcast.
the class CacheIterator method fetch.
protected List fetch() {
final OperationService operationService = cacheProxy.getNodeEngine().getOperationService();
if (prefetchValues) {
Operation operation = cacheProxy.operationProvider.createFetchEntriesOperation(pointers, fetchSize);
CacheEntriesWithCursor iteratorResult = invoke(operationService, operation);
setIterationPointers(iteratorResult.getEntries(), iteratorResult.getPointers());
return iteratorResult.getEntries();
} else {
Operation operation = cacheProxy.operationProvider.createFetchKeysOperation(pointers, fetchSize);
CacheKeysWithCursor iteratorResult = invoke(operationService, operation);
setIterationPointers(iteratorResult.getKeys(), iteratorResult.getPointers());
return iteratorResult.getKeys();
}
}
Aggregations