private void lockAndRegisterReferences ( ClassDescriptor cld , Object sourceObject , int lockMode , List registeredObjects ) throws LockNotGrantedException { if ( implicitLocking ) { Iterator i = cld . getObjectReferenceDescriptors ( true ) . iterator ( ) ; while ( i . hasNext ( ) ) { ObjectReferenceDescriptor rds = ( ObjectReferenceDescriptor ) i . next ( ) ; Object refObj = rds . getPersistentField ( ) . get ( sourceObject ) ; if ( refObj != null ) { boolean isProxy = ProxyHelper . isProxy ( refObj ) ; RuntimeObject rt = isProxy ? new RuntimeObject ( refObj , this , false ) : new RuntimeObject ( refObj , this ) ; if ( ! registrationList . contains ( rt . getIdentity ( ) ) ) { lockAndRegister ( rt , lockMode , registeredObjects ) ; } } } } }
we only use the registrationList map if the object is not a proxy . During the reference locking we will materialize objects and they will enter the registered for lock map .