code: public boolean checkWrite(TransactionImpl tx, Object obj)
      {
          LockEntry writer = getWriter(obj);
          if (writer == null)
              return false;
          else if (writer.isOwnedBy(tx))
              return true;
          else
              return false;
      }
docs: checks whether the specified Object obj is write-locked by Transaction tx.
  @param tx the transaction
  @param obj the Object to be checked
  @return true if lock exists, else false