docs: private boolean checkMisroutedFragmentTaskMessage(FragmentTaskMessage message) {
          if (m_scheduler.isLeader() || message.isForReplica()) {
              return false;
          }
  
          TransactionState txnState = (((SpScheduler)m_scheduler).getTransactionState(message.getTxnId()));
  
          // If a fragment is part of a transaction which have not been seen on this site, restart it.
          if (txnState == null) {
              FragmentResponseMessage response = new FragmentResponseMessage(message, getHSId());
              TransactionRestartException restart = new TransactionRestartException(
                      "Transaction being restarted due to MigratePartitionLeader.", message.getTxnId());
              restart.setMisrouted(true);
              response.setStatus(FragmentResponseMessage.UNEXPECTED_ERROR, restart);
              response.m_sourceHSId = getHSId();
              response.setPartitionId(m_partitionId);
              if (tmLog.isDebugEnabled()) {
                  tmLog.debug("misRoutedFragMsg on site:" + CoreUtils.hsIdToString(getHSId()) + "\n" + message);
              }
              deliver(response);
              return true;
          }
  
          // A transaction may have multiple batches or fragments. If the first batch or fragment has already been
          // processed, the follow-up batches or fragments should also be processed on this site.
          if (!m_scheduler.isLeader() && !message.isForReplica()) {
              message.setExecutedOnPreviousLeader(true);
              txnState.setLeaderMigrationInvolved();
              if (tmLog.isDebugEnabled()) {
                  tmLog.debug("Follow-up fragment will be processed on " + CoreUtils.hsIdToString(getHSId()) + "\n" + message);
              }
          }
          return false;
      }