public void trackObject(final ClassMolder molder, final OID oid, final Object object) {
    _operation++;
    Object aObject = supportCGLibObject(object);

    setMolderForObject(aObject, molder);
    setOIDForObject(aObject, molder.getLockEngine(), oid);
    _readWriteSet.add(aObject);
  }
  /**
   * "Transform" an object provided as a LazyCGLib into a 'natural' object within the transaction,
   * undecorated. This allows us to find the true object associated with a decorated object in the
   * transaction.
   *
   * <p>We do this by asking the decorated object for enough information to re-generate its proper
   * OID; we then go looking for that OID in the system to find the object in the transaction.
   *
   * @param object
   * @return
   */
  private Object supportCGLibObject(final Object object) {
    if (object instanceof LazyCGLIB) {
      LazyCGLIB cgObject = (LazyCGLIB) object;

      // TODO [WG] We still might have an option for some serious optimization
      // here if the instance has not been materialized yet.
      Identity identity = cgObject.interceptedIdentity();
      ClassMolder molder = cgObject.interceptedClassMolder();
      LockEngine engine = molder.getLockEngine();

      // Get the OID we're looking for.
      OID oid = new OID(molder, identity);

      // Retrieve the object for this OID; returns null if there ain't such object
      return getObjectForOID(engine, oid, true);
    }

    return object;
  }
    public int compare(final Object object1, final Object object2) {
      Map.Entry entry1 = (Map.Entry) object1;
      Map.Entry entry2 = (Map.Entry) object2;

      long oper1 = ((Long) entry1.getValue()).longValue();
      long oper2 = ((Long) entry2.getValue()).longValue();

      ClassMolder molder1 = _tracker.getMolderForObject(entry1.getKey());
      ClassMolder molder2 = _tracker.getMolderForObject(entry2.getKey());

      if (molder1 == null || molder2 == null) {
        if (oper1 > oper2) {
          return 1;
        } else if (oper1 < oper2) {
          return -1;
        } else {
          return 0;
        }
      }

      int pri1 = molder1.getPriority();
      int pri2 = molder2.getPriority();

      if (pri1 == pri2) {
        if (oper1 > oper2) {
          return 1;
        }
        if (oper1 < oper2) {
          return -1;
        }
        return 0;
      }

      if (_reverseOrder) {
        return (pri1 < pri2) ? 1 : -1;
      }
      return (pri1 < pri2) ? -1 : 1;
    }