code: private synchronized void setStatus(final DriverStatus toStatus) {
      if (this.driverStatus.isLegalTransition(toStatus)) {
        this.driverStatus = toStatus;
      } else {
        LOG.log(Level.WARNING, "Illegal state transition: {0} -> {1}", new Object[] {this.driverStatus, toStatus});
      }
    }
docs: Helper method to set the status.
  This also checks whether the transition from the current status to the new one is legal.
  @param toStatus Driver status to transition to.