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; }