boolean done(final long txid, final Throwable t) {
    doneLock.lock();
    try {
      if (doneTxid != NOT_DONE) {
        return false;
      }
      this.throwable = t;
      if (txid < this.txid) {
        // Something badly wrong.
        if (throwable == null) {
          this.throwable =
            new IllegalStateException("done txid=" + txid + ", my txid=" + this.txid);
        }
      }
      // Mark done.
      this.doneTxid = txid;
      doneCondition.signalAll();
      return true;
    } finally {
      doneLock.unlock();
    }
  }
@param txid the transaction id at which this future 'completed'.
@param t    Can be null. Set if we are 'completing' on error (and this 't' is the error).
@return True if we successfully marked this outstanding future as completed/done. Returns false
        if this future is already 'done' when this method called.
hbase-server/src/main/java/org/apache/hadoop/hbase/regionserver/wal/SyncFuture.java