db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From arm...@apache.org
Subject svn commit: r387891 - /db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/odmg/TransactionImpl.java
Date Wed, 22 Mar 2006 17:00:33 GMT
Author: arminw
Date: Wed Mar 22 09:00:31 2006
New Revision: 387891

URL: http://svn.apache.org/viewcvs?rev=387891&view=rev
Log:
minor improvement, better separation of proxy object locking

Modified:
    db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/odmg/TransactionImpl.java

Modified: db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/odmg/TransactionImpl.java
URL: http://svn.apache.org/viewcvs/db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/odmg/TransactionImpl.java?rev=387891&r1=387890&r2=387891&view=diff
==============================================================================
--- db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/odmg/TransactionImpl.java (original)
+++ db/ojb/branches/OJB_1_0_RELEASE/src/java/org/apache/ojb/odmg/TransactionImpl.java Wed
Mar 22 09:00:31 2006
@@ -307,8 +307,7 @@
                 }
                 else
                 {
-                    registerToIndirectionHandler(handler);
-                    lockUnmaterializedObject(rtObject, lockMode);
+                    lockUnmaterializedObject(rtObject, lockMode, handler);
                     // all work is done, so set to null to skip
                     // "normal" registration/lock below
                     objectToRegister = null;
@@ -395,9 +394,9 @@
      */
     void internalSingleLock(final ClassDescriptor cld, final Identity oid, final int lockMode)
throws LockNotGrantedException
     {
-        LockManager lm = implementation.getLockManager();
         if (cld.isAcceptLocks())
         {
+            LockManager lm = implementation.getLockManager();
             if (lockMode == Transaction.READ)
             {
                 if (log.isDebugEnabled()) log.debug("Do READ lock on object: " + oid);
@@ -1174,10 +1173,14 @@
      * @param rtObj The unmaterialized proxy.
      * @param lockMode The lock mode.
      */
-    private void lockUnmaterializedObject(final RuntimeObject rtObj, final int lockMode)
+    private void lockUnmaterializedObject(final RuntimeObject rtObj, final int lockMode,
final IndirectionHandler handler)
     {
-        // TODO: remove this list when deprecated locking classes are removed
-        unmaterializedLocks.add(rtObj);
+        registerToIndirectionHandler(handler);
+        // TODO: remove this section when deprecated locking classes are removed
+        if(!(getImplementation().getLockManager() instanceof LockManagerOdmgImpl))
+        {
+            unmaterializedLocks.add(rtObj);
+        }
         if(log.isDebugEnabled()) log.debug("Lock unmaterialized proxy object: " + rtObj.getIdentity());
         internalSingleLock(rtObj.getCld(), rtObj.getIdentity(), lockMode);
     }
@@ -1189,13 +1192,14 @@
      * The new lock implementation fully supports methods
      * {@link org.apache.ojb.odmg.locking.LockManager#releaseLocks(org.apache.ojb.odmg.TransactionImpl)}
      * the old ones need this method.
+     * 
      * @deprecated will be removed
      */
     public void releaseUnmaterialzedLocks()
     {
         // TODO: remove this method when deprecated locking classes are removed
         LockManager lm = getImplementation().getLockManager();
-        if(!(lm instanceof LockManagerOdmgImpl))
+        if(!(lm instanceof LockManagerOdmgImpl) && unmaterializedLocks.size() >
0)
         {
             //remove locks for objects which haven't been materialized yet
             for (Iterator it = unmaterializedLocks.iterator(); it.hasNext();)
@@ -1214,6 +1218,7 @@
      * very good chance the broker will be leaked as the doClose() method of
      * transactionImpl will never be called and thus the broker will never
      * be closed and returned to the pool.
+     *
      * @return Returns a PersistenceBroker
      * @throws TransactionNotInProgressException is the transaction is not open;
      */



---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-dev-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-dev-help@db.apache.org


Mime
View raw message