code: public void attach() {
          mLock.lock();
          try {
              if (mTxnMgr.setLocalScope(this, mDetached)) {
                  mDetached = false;
              } else if (!mDetached) {
                  throw new IllegalStateException("Transaction scope is not detached");
              } else {
                  throw new IllegalStateException
                      ("Current thread has a different transaction already attached");
              }
          } finally {
              mLock.unlock();
          }
      }
docs: Attach this scope to the current thread, if it has been {@link
  TransactionManager#detachLocalScope detached}.
  
  @throws IllegalStateException if current thread has a different
  transaction already attached