code: public static final Transaction.Status encode(final TxnState.State state, final String logString) {
          Preconditions.checkNotNull(state, "state");
          Exceptions.checkNotNullOrEmpty(logString, "logString");
  
          Transaction.Status result;
          switch (state) {
              case COMMITTED:
                  result = Transaction.Status.COMMITTED;
                  break;
              case ABORTED:
                  result = Transaction.Status.ABORTED;
                  break;
              case OPEN:
                  result = Transaction.Status.OPEN;
                  break;
              case ABORTING:
                  result = Transaction.Status.ABORTING;
                  break;
              case COMMITTING:
                  result = Transaction.Status.COMMITTING;
                  break;
              case UNKNOWN:
                  throw new RuntimeException("Unknown transaction: " + logString);
              case UNRECOGNIZED:
              default:
                  throw new IllegalStateException("Unknown status: " + state);
          }
          return result;
      }
docs: Returns actual status of given transaction status instance.
  
  @param state     TxnState object instance.
  @param logString Description text to be logged when transaction status is invalid.
  @return Transaction.Status