openjpa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From allee8...@apache.org
Subject svn commit: r1044006 - in /openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel: BrokerImpl.java LockManager.java NoneLockManager.java VersionLockManager.java
Date Thu, 09 Dec 2010 15:33:11 GMT
Author: allee8285
Date: Thu Dec  9 15:33:11 2010
New Revision: 1044006

URL: http://svn.apache.org/viewvc?rev=1044006&view=rev
Log:
OPENJPA-1904 Propagate refresh operation for eagerly fetched relationship fields.

Modified:
    openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/BrokerImpl.java
    openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/LockManager.java
    openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/NoneLockManager.java
    openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/VersionLockManager.java

Modified: openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/BrokerImpl.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/BrokerImpl.java?rev=1044006&r1=1044005&r2=1044006&view=diff
==============================================================================
--- openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/BrokerImpl.java (original)
+++ openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/BrokerImpl.java Thu
Dec  9 15:33:11 2010
@@ -3011,7 +3011,7 @@ public class BrokerImpl
                         }
                         int level = _fc.getReadLockLevel();
                         int timeout = _fc.getLockTimeout();
-                        _lm.lock(sm, level, timeout, null, false);
+                        _lm.refreshLock(sm, level, timeout, null);
                         sm.readLocked(level, level);
                     } else if (assertPersistenceCapable(obj).pcIsDetached()
                         == Boolean.TRUE)
@@ -3083,7 +3083,7 @@ public class BrokerImpl
                 }
                 int level = _fc.getReadLockLevel();
                 int timeout = _fc.getLockTimeout();
-                _lm.lock(sm, level, timeout, null, false);
+                _lm.refreshLock(sm, level, timeout, null);
                 sm.readLocked(level, level);
                 fireLifecycleEvent(sm.getManagedInstance(), null,
                     sm.getMetaData(), LifecycleEvent.AFTER_REFRESH);

Modified: openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/LockManager.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/LockManager.java?rev=1044006&r1=1044005&r2=1044006&view=diff
==============================================================================
--- openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/LockManager.java
(original)
+++ openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/LockManager.java
Thu Dec  9 15:33:11 2010
@@ -74,8 +74,8 @@ public interface LockManager
      * Perform the same function as previous lock method and has the option
      * to perform a version check after the lock function has completed. 
      */
-    public void lock(OpenJPAStateManager sm, int level, int timeout,
-        Object sdata, boolean postLockVersionCheck);
+    public void refreshLock(OpenJPAStateManager sm, int level, int timeout,
+        Object sdata);
     
     /**
      * Obtain locks on the specified objects.

Modified: openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/NoneLockManager.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/NoneLockManager.java?rev=1044006&r1=1044005&r2=1044006&view=diff
==============================================================================
--- openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/NoneLockManager.java
(original)
+++ openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/NoneLockManager.java
Thu Dec  9 15:33:11 2010
@@ -33,8 +33,8 @@ public class NoneLockManager
         sm.setLock(Boolean.TRUE);
     }
 
-    public void lock(OpenJPAStateManager sm, int level, int timeout,
-        Object context, boolean postLockVersionCheck) {
+    public void refreshLock(OpenJPAStateManager sm, int level, int timeout,
+        Object context) {
         sm.setLock(Boolean.TRUE);
     }
 

Modified: openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/VersionLockManager.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/VersionLockManager.java?rev=1044006&r1=1044005&r2=1044006&view=diff
==============================================================================
--- openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/VersionLockManager.java
(original)
+++ openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/VersionLockManager.java
Thu Dec  9 15:33:11 2010
@@ -31,6 +31,7 @@ public class VersionLockManager
 
     private boolean _versionCheckOnReadLock = true;
     private boolean _versionUpdateOnWriteLock = true;
+    private boolean _refreshing = false;
 
     /**
      * Returns the given instance's lock level, assuming that the state's
@@ -67,10 +68,20 @@ public class VersionLockManager
      */
     public void lock(OpenJPAStateManager sm, int level, int timeout,
         Object sdata) {
-        lock(sm, level, timeout, sdata, true);
+        commonLock(sm, level, timeout, sdata, !_refreshing);
     }
     
-    public void lock(OpenJPAStateManager sm, int level, int timeout,
+    public void refreshLock(OpenJPAStateManager sm, int level, int timeout,
+            Object sdata) {
+    	try {
+        	_refreshing = true;
+    		commonLock(sm, level, timeout, sdata, false);
+    	} finally {
+        	_refreshing = false;    		
+    	}
+    }
+
+    private void commonLock(OpenJPAStateManager sm, int level, int timeout,
             Object sdata, boolean postLockVersionCheck) {
         if (level == LOCK_NONE)
             return;



Mime
View raw message