code: void detach() {
          mLock.lock();
          try {
              if (mDetached || mTxnMgr.removeLocalScope(this)) {
                  mDetached = true;
              } else {
                  throw new IllegalStateException("Transaction is attached to a different thread");
              }
          } finally {
              mLock.unlock();
          }
      }
docs: Called by TransactionImpl.