use of com.hazelcast.cluster.Address in project hazelcast by hazelcast.
the class ScheduledExecutorServiceProxy method submitOnMemberSync.
@Nonnull
private <V> IScheduledFuture<V> submitOnMemberSync(String taskName, Operation op, Member member) {
UUID uuid = member.getUuid();
Address address = member.getAddress();
getOperationService().invokeOnTarget(getServiceName(), op, address).joinInternal();
return createFutureProxy(uuid, taskName);
}
use of com.hazelcast.cluster.Address in project hazelcast by hazelcast.
the class TransactionManagerServiceImpl method pickBackupLogAddresses.
Address[] pickBackupLogAddresses(int durability) {
if (durability == 0) {
return EMPTY_ADDRESSES;
}
// This should be cleaned up because this is quite a complex approach since it depends on
// the number of members in the cluster and creates litter.
ClusterService clusterService = nodeEngine.getClusterService();
List<MemberImpl> members = new ArrayList<>(clusterService.getMemberImpls());
members.remove(nodeEngine.getLocalMember());
int c = Math.min(members.size(), durability);
shuffle(members);
Address[] addresses = new Address[c];
for (int i = 0; i < c; i++) {
addresses[i] = members.get(i).getAddress();
}
return addresses;
}
use of com.hazelcast.cluster.Address 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.cluster.Address 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);
}
use of com.hazelcast.cluster.Address in project hazelcast by hazelcast.
the class TransactionLog method invokeAsync.
private void invokeAsync(NodeEngine nodeEngine, BiConsumer callback, TransactionLogRecord record, Operation op) {
OperationServiceImpl operationService = (OperationServiceImpl) nodeEngine.getOperationService();
if (record instanceof TargetAwareTransactionLogRecord) {
Address target = ((TargetAwareTransactionLogRecord) record).getTarget();
operationService.invokeOnTarget(op.getServiceName(), op, target);
} else {
operationService.invokeOnPartitionAsync(op.getServiceName(), op, op.getPartitionId()).whenCompleteAsync(callback);
}
}
Aggregations