static void shutdownOperationService(HazelcastInstance instance) {
   if (instance == null) {
     return;
   }
   OperationServiceImpl operationService = (OperationServiceImpl) getOperationService(instance);
   operationService.shutdown();
 }
Ejemplo n.º 2
0
  private int makeBackups(
      BackupAwareOperation backupAwareOp,
      int partitionId,
      long[] replicaVersions,
      int syncBackups,
      int asyncBackups) {
    int sendSyncBackups = 0;

    InternalPartitionService partitionService = node.getPartitionService();
    InternalPartition partition = partitionService.getPartition(partitionId);

    Data backupOpData = getBackupOperationData(backupAwareOp);

    for (int replicaIndex = 1; replicaIndex <= syncBackups + asyncBackups; replicaIndex++) {
      Address target = partition.getReplicaAddress(replicaIndex);

      if (target == null) {
        continue;
      }

      assertNoBackupOnPrimaryMember(partition, target);

      boolean isSyncBackup = replicaIndex <= syncBackups;

      Backup backup =
          newBackup(backupAwareOp, backupOpData, replicaVersions, replicaIndex, isSyncBackup);
      operationService.send(backup, target);

      if (isSyncBackup) {
        sendSyncBackups++;
      }
    }

    return sendSyncBackups;
  }
Ejemplo n.º 3
0
  @Override
  public void afterRun() throws Exception {
    if (!valid || !sync || getCallId() == 0 || originalCaller == null) {
      return;
    }

    NodeEngineImpl nodeEngine = (NodeEngineImpl) getNodeEngine();
    long callId = getCallId();
    OperationServiceImpl operationService = (OperationServiceImpl) nodeEngine.getOperationService();

    if (nodeEngine.getThisAddress().equals(originalCaller)) {
      operationService.getInvocationsRegistry().notifyBackupComplete(callId);
    } else {
      BackupResponse backupResponse = new BackupResponse(callId, backupOp.isUrgent());
      operationService.send(backupResponse, originalCaller);
    }
  }