isis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From danhayw...@apache.org
Subject svn commit: r1377999 - in /incubator/isis/trunk/framework: core/metamodel/src/main/java/org/apache/isis/core/metamodel/adapter/oid/ runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/persistence/adaptermanager/
Date Tue, 28 Aug 2012 07:07:11 GMT
Author: danhaywood
Date: Tue Aug 28 07:07:11 2012
New Revision: 1377999

URL: http://svn.apache.org/viewvc?rev=1377999&view=rev
Log:
ISIS-14: checkLock algorithm changes

Modified:
    incubator/isis/trunk/framework/core/metamodel/src/main/java/org/apache/isis/core/metamodel/adapter/oid/RootOidDefault.java
    incubator/isis/trunk/framework/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/persistence/adaptermanager/AdapterManagerDefault.java

Modified: incubator/isis/trunk/framework/core/metamodel/src/main/java/org/apache/isis/core/metamodel/adapter/oid/RootOidDefault.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/core/metamodel/src/main/java/org/apache/isis/core/metamodel/adapter/oid/RootOidDefault.java?rev=1377999&r1=1377998&r2=1377999&view=diff
==============================================================================
--- incubator/isis/trunk/framework/core/metamodel/src/main/java/org/apache/isis/core/metamodel/adapter/oid/RootOidDefault.java
(original)
+++ incubator/isis/trunk/framework/core/metamodel/src/main/java/org/apache/isis/core/metamodel/adapter/oid/RootOidDefault.java
Tue Aug 28 07:07:11 2012
@@ -285,17 +285,13 @@ public final class RootOidDefault implem
     @Override
     public void checkLock(String currentUser, RootOid otherOid) {
         Version otherVersion = otherOid.getVersion();
-        try {
-            if(version == null || otherVersion == null) {
-                return;
-            }
-            if (version.different(otherVersion)) {
-                LOG.info("concurrency conflict on " + this + " (" + otherVersion + ")");
-                // reset this Oid to latest
-                throw new ConcurrencyException(currentUser, this, version, otherVersion);
-            }
-        } finally {
-            setVersion(otherVersion);
+        if(version == null || otherVersion == null) {
+            return;
+        }
+        if (version.different(otherVersion)) {
+            LOG.info("concurrency conflict on " + this + " (" + otherVersion + ")");
+            // reset this Oid to latest
+            throw new ConcurrencyException(currentUser, this, version, otherVersion);
         }
     }
 

Modified: incubator/isis/trunk/framework/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/persistence/adaptermanager/AdapterManagerDefault.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/framework/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/persistence/adaptermanager/AdapterManagerDefault.java?rev=1377999&r1=1377998&r2=1377999&view=diff
==============================================================================
--- incubator/isis/trunk/framework/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/persistence/adaptermanager/AdapterManagerDefault.java
(original)
+++ incubator/isis/trunk/framework/runtimes/dflt/runtime/src/main/java/org/apache/isis/runtimes/dflt/runtime/persistence/adaptermanager/AdapterManagerDefault.java
Tue Aug 28 07:07:11 2012
@@ -291,12 +291,16 @@ public class AdapterManagerDefault imple
         final Object pojo = pojoRecreator.recreatePojo(typedOid);
         adapter = mapRecreatedPojo(typedOid, pojo);
         
-        if(concurrencyChecking == ConcurrencyChecking.CHECK) {
-            final Oid adapterOid = adapter.getOid();
-            if(adapterOid instanceof RootOid) {
-                final RootOid recreatedOid = (RootOid) adapterOid;
-                final RootOid originalOid = (RootOid) typedOid;
-                recreatedOid.checkLock(getAuthenticationSession().getUserName(), originalOid);
+        final Oid adapterOid = adapter.getOid();
+        if(adapterOid instanceof RootOid) {
+            final RootOid recreatedOid = (RootOid) adapterOid;
+            final RootOid originalOid = (RootOid) typedOid;
+            try {
+                if(concurrencyChecking == ConcurrencyChecking.CHECK) {
+                    recreatedOid.checkLock(getAuthenticationSession().getUserName(), originalOid);
+                }
+            } finally {
+                originalOid.setVersion(recreatedOid.getVersion());
             }
         }
         return adapter;



Mime
View raw message