use of com.hazelcast.spi.impl.operationservice.OperationService in project hazelcast by hazelcast.
the class ReplicatedMapProxy method requestDataForPartition.
private void requestDataForPartition(int partitionId) {
RequestMapDataOperation requestMapDataOperation = new RequestMapDataOperation(name);
OperationService operationService = nodeEngine.getOperationService();
operationService.createInvocationBuilder(SERVICE_NAME, requestMapDataOperation, partitionId).setTryCount(ReplicatedMapService.INVOCATION_TRY_COUNT).invoke();
}
use of com.hazelcast.spi.impl.operationservice.OperationService 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<>();
for (Member member : members) {
Operation op = new ShutdownOperation(name);
calls.add(operationService.invokeOnTarget(SERVICE_NAME, op, member.getAddress()));
}
waitWithDeadline(calls, SHUTDOWN_TIMEOUT, TimeUnit.SECONDS, shutdownExceptionHandler);
}
use of com.hazelcast.spi.impl.operationservice.OperationService in project hazelcast by hazelcast.
the class WaitSet method unpark.
// Runs in partition-thread, and therefor we can assume we have exclusive access to the WaitNotifyKey
// (since each WaitNotifyKey is mapped to a single partition). So a park will not be concurrently
// executed with an unpark for the same key.
public void unpark(Notifier notifier, WaitNotifyKey key) {
WaitSetEntry entry = queue.peek();
while (entry != null) {
Operation op = entry.getOperation();
if (notifier == op) {
throw new IllegalStateException("Found cyclic wait-notify! -> " + notifier);
}
if (entry.isValid()) {
if (entry.isExpired()) {
// expired
entry.onExpire();
} else if (entry.isCancelled()) {
entry.onCancel();
} else {
if (entry.shouldWait()) {
return;
}
OperationService operationService = nodeEngine.getOperationService();
operationService.run(op);
}
entry.setValid(false);
}
// consume
queue.poll();
entry = queue.peek();
// We can safely remove this queue from registration map here.
if (entry == null) {
waitSetMap.remove(key);
}
}
}
use of com.hazelcast.spi.impl.operationservice.OperationService in project hazelcast by hazelcast.
the class TransactionImpl method replicateTxnLog.
private void replicateTxnLog() {
if (skipBackupLogReplication()) {
return;
}
OperationService operationService = nodeEngine.getOperationService();
ClusterService clusterService = nodeEngine.getClusterService();
List<Future> futures = new ArrayList<Future>(backupAddresses.length);
for (Address backupAddress : backupAddresses) {
if (clusterService.getMember(backupAddress) != null) {
Operation op = createReplicateTxBackupLogOperation();
Future f = operationService.invokeOnTarget(SERVICE_NAME, op, backupAddress);
futures.add(f);
}
}
waitWithDeadline(futures, timeoutMillis, MILLISECONDS, replicationTxExceptionHandler);
}
use of com.hazelcast.spi.impl.operationservice.OperationService in project hazelcast by hazelcast.
the class TransactionImpl method rollbackBackupLogs.
private void rollbackBackupLogs() {
if (!backupLogsCreated) {
return;
}
OperationService operationService = nodeEngine.getOperationService();
ClusterService clusterService = nodeEngine.getClusterService();
List<Future> futures = new ArrayList<Future>(backupAddresses.length);
for (Address backupAddress : backupAddresses) {
if (clusterService.getMember(backupAddress) != null) {
Future f = operationService.invokeOnTarget(SERVICE_NAME, createRollbackTxBackupLogOperation(), backupAddress);
futures.add(f);
}
}
waitWithDeadline(futures, timeoutMillis, MILLISECONDS, rollbackTxExceptionHandler);
}
Aggregations