docs: public final synchronized boolean waitUntilPrepared(boolean commit)
           throws InterruptedException {
        boolean result;
  
        State state = commit ? State.COMMIT_ONLY : State.ROLLBACK_ONLY;
        if (trace) {
           log.tracef("[%s] Current status is %s, setting status to: %s", globalTransaction.globalId(),
                      transactionState, state);
        }
        transactionState.add(state);
  
        if (transactionState.contains(State.PREPARED)) {
           result = true;
           if (trace) {
              log.tracef("[%s] Transaction is PREPARED", globalTransaction.globalId());
           }
        } else if (transactionState.contains(State.PREPARING)) {
           wait();
           result = true;
           if (trace) {
              log.tracef("[%s] Transaction was in PREPARING state but now it is prepared", globalTransaction.globalId());
           }
        } else {
           if (trace) {
              log.tracef("[%s] Transaction is not delivered yet", globalTransaction.globalId());
           }
           result = false;
        }
        return result;
     }