code: public synchronized boolean detectRestart() {
      if (this.state.hasNotRestarted()) {
        resubmissionAttempts = driverRuntimeRestartManager.getResubmissionAttempts();
  
        if (resubmissionAttempts > 0) {
          // set the state machine in motion.
          this.state = DriverRestartState.BEGAN;
        }
      }
  
      return this.state.hasRestarted();
    }
docs: Triggers the state machine if the application is a restart instance. Returns true
  @return true if the application is a restart instance.
  Can be already done with restart or in the process of restart.