code: public boolean lockedBy(Transaction transaction)
      {
          if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
              trace.entry(this,
                          cclass,
                          "lockedBy",
                          new Object[] { transaction });
          InternalTransaction internalTransaction = null;
          if (transaction != null)
              internalTransaction = transaction.internalTransaction;
          if (transactionLock.getLockingTransaction() == internalTransaction)
          {
              if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
                  trace.exit(this,
                             cclass,
                             "lockedBy",
                             "returns true");
              return true;
          } else {
              if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
                  trace.exit(this,
                             cclass,
                             "lockedBy",
                             "returns false");
              return false;
          }
      }
docs: <p>
  Tests to see if this ManagedObject is locked by a given transaction.
  Not synchronized because whoever calls this must be holding a corser lock in order that the
  result will be useful.
  <\p>
  
  @param transaction testing the lock, may be null.
  @return true if the ManagedObject is locked by the transaction,
  or if the ManagedObject is not locked by any transaction and thr transaction is null.