docs: public void transition(RaftServer.Role role) {
      checkThread();
      checkNotNull(role);
  
      if (this.role.role() == role) {
        return;
      }
  
      log.info("Transitioning to {}", role);
  
      // Close the old state.
      try {
        this.role.stop().get();
      } catch (InterruptedException | ExecutionException e) {
        throw new IllegalStateException("failed to close Raft state", e);
      }
  
      // Force state transitions to occur synchronously in order to prevent race conditions.
      try {
        this.role = createRole(role);
        this.role.start().get();
      } catch (InterruptedException | ExecutionException e) {
        throw new IllegalStateException("failed to initialize Raft state", e);
      }
  
      roleChangeListeners.forEach(l -> l.accept(this.role.role()));
    }