use of com.hazelcast.spi.NodeEngine in project hazelcast by hazelcast.
the class ObjectMultiMapProxy method addEntryListener.
@Override
public String addEntryListener(EntryListener<K, V> listener, K key, boolean includeValue) {
final NodeEngine nodeEngine = getNodeEngine();
Data dataKey = nodeEngine.toData(key);
return getService().addListener(name, listener, dataKey, includeValue, false);
}
use of com.hazelcast.spi.NodeEngine in project hazelcast by hazelcast.
the class TransactionalMultiMapProxySupport method nextId.
private long nextId(Data key) {
final NodeEngine nodeEngine = getNodeEngine();
TxnGenerateRecordIdOperation operation = new TxnGenerateRecordIdOperation(name, key);
try {
int partitionId = nodeEngine.getPartitionService().getPartitionId(key);
final OperationService operationService = nodeEngine.getOperationService();
Future<Long> f = operationService.invokeOnPartition(MultiMapService.SERVICE_NAME, operation, partitionId);
return f.get();
} catch (Throwable t) {
throw ExceptionUtil.rethrow(t);
}
}
use of com.hazelcast.spi.NodeEngine in project hazelcast by hazelcast.
the class TransactionalMultiMapProxySupport method lockAndGet.
private MultiMapResponse lockAndGet(Data key, long timeout, long ttl) {
final NodeEngine nodeEngine = getNodeEngine();
boolean blockReads = tx.getTransactionType() == TransactionType.ONE_PHASE;
TxnLockAndGetOperation operation = new TxnLockAndGetOperation(name, key, timeout, ttl, getThreadId(), blockReads);
try {
int partitionId = nodeEngine.getPartitionService().getPartitionId(key);
final OperationService operationService = nodeEngine.getOperationService();
Future<MultiMapResponse> f = operationService.invokeOnPartition(MultiMapService.SERVICE_NAME, operation, partitionId);
return f.get();
} catch (Throwable t) {
throw ExceptionUtil.rethrow(t);
}
}
use of com.hazelcast.spi.NodeEngine in project hazelcast by hazelcast.
the class ScheduledExecutorServiceProxy method shutdown.
@Override
public void shutdown() {
NodeEngine nodeEngine = getNodeEngine();
Collection<Member> members = nodeEngine.getClusterService().getMembers();
OperationService operationService = nodeEngine.getOperationService();
Collection<Future> calls = new LinkedList<Future>();
for (Member member : members) {
if (member.localMember()) {
getService().shutdownExecutor(name);
} else {
Operation op = new ShutdownOperation(name);
calls.add(operationService.invokeOnTarget(SERVICE_NAME, op, member.getAddress()));
}
}
waitWithDeadline(calls, SHUTDOWN_TIMEOUT, TimeUnit.SECONDS, WHILE_SHUTDOWN_EXCEPTION_HANDLER);
}
use of com.hazelcast.spi.NodeEngine in project hazelcast by hazelcast.
the class PartitionIteratingOperation method executeOperations.
private void executeOperations() {
NodeEngine nodeEngine = getNodeEngine();
OperationResponseHandler responseHandler = new OperationResponseHandlerImpl(partitions);
OperationService operationService = nodeEngine.getOperationService();
Object service = getServiceName() == null ? null : getService();
for (int partitionId : partitions) {
Operation operation = operationFactory.createOperation().setNodeEngine(nodeEngine).setPartitionId(partitionId).setReplicaIndex(getReplicaIndex()).setOperationResponseHandler(responseHandler).setServiceName(getServiceName()).setService(service).setCallerUuid(extractCallerUuid());
OperationAccessor.setCallerAddress(operation, getCallerAddress());
operationService.execute(operation);
}
}
Aggregations