docs: void finalizeMigration(MigrationInfo migrationInfo) {
          try {
              PartitionReplica localReplica = PartitionReplica.from(node.getLocalMember());
              int partitionId = migrationInfo.getPartitionId();
  
              boolean source = localReplica.equals(migrationInfo.getSource());
              boolean destination = localReplica.equals(migrationInfo.getDestination());
  
              assert migrationInfo.getStatus() == MigrationStatus.SUCCESS
                      || migrationInfo.getStatus() == MigrationStatus.FAILED : "Invalid migration: " + migrationInfo;
  
              if (source || destination) {
                  boolean success = migrationInfo.getStatus() == MigrationStatus.SUCCESS;
  
                  MigrationParticipant participant = source ? MigrationParticipant.SOURCE : MigrationParticipant.DESTINATION;
                  if (success) {
                      internalMigrationListener.onMigrationCommit(participant, migrationInfo);
                  } else {
                      internalMigrationListener.onMigrationRollback(participant, migrationInfo);
                  }
  
                  MigrationEndpoint endpoint = source ? MigrationEndpoint.SOURCE : MigrationEndpoint.DESTINATION;
                  FinalizeMigrationOperation op = new FinalizeMigrationOperation(migrationInfo, endpoint, success);
                  op.setPartitionId(partitionId).setNodeEngine(nodeEngine).setValidateTarget(false)
                          .setService(partitionService);
                  InternalOperationService operationService = nodeEngine.getOperationService();
                  if (operationService.isRunAllowed(op)) {
                      // When migration finalization is triggered by subsequent migrations
                      // on partition thread, finalization may run directly on calling thread.
                      // Otherwise, if previously completed migration and newly submitted migration
                      // are on the same partition, then finalizing previous migration later will
                      // break the order, hence safety.
                      operationService.run(op);
                  } else {
                      operationService.execute(op);
                  }
                  removeActiveMigration(partitionId);
              } else {
                  PartitionReplica partitionOwner = partitionStateManager.getPartitionImpl(partitionId).getOwnerReplicaOrNull();
                  if (localReplica.equals(partitionOwner)) {
                      removeActiveMigration(partitionId);
                      partitionStateManager.clearMigratingFlag(partitionId);
                  } else {
                      logger.severe("Failed to finalize migration because " + localReplica
                              + " is not a participant of the migration: " + migrationInfo);
                  }
              }
          } catch (Exception e) {
              logger.warning(e);
          } finally {
              migrationInfo.doneProcessing();
          }
      }