You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by mb...@apache.org on 2017/10/07 10:23:02 UTC

svn commit: r1811406 - /ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/semaphore/ServiceSemaphore.java

Author: mbrohl
Date: Sat Oct  7 10:23:02 2017
New Revision: 1811406

URL: http://svn.apache.org/viewvc?rev=1811406&view=rev
Log:
Fixed: Exception in service semaphore in wait mode and with multi 
thread calls.
(OFBIZ-9534).

Thanks Pierre Gaudin for reporting and providing the patch.


Modified:
    ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/semaphore/ServiceSemaphore.java

Modified: ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/semaphore/ServiceSemaphore.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/semaphore/ServiceSemaphore.java?rev=1811406&r1=1811405&r2=1811406&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/semaphore/ServiceSemaphore.java (original)
+++ ofbiz/ofbiz-framework/trunk/framework/service/src/main/java/org/apache/ofbiz/service/semaphore/ServiceSemaphore.java Sat Oct  7 10:23:02 2017
@@ -129,7 +129,12 @@ public class ServiceSemaphore {
             semaphore = delegator.makeValue("ServiceSemaphore", "serviceName", model.name, "lockedByInstanceId", JobManager.instanceId, "lockThread", threadName, "lockTime", lockTime);
 
             // use the special method below so we can reuse the unqiue tx functions
-            dbWrite(semaphore, false);
+            try {
+                dbWrite(semaphore, false);
+            } catch (SemaphoreFailException e) {
+                // can't write a new semaphore, need to wait
+                return true;
+            }
 
             // we own the lock, no waiting
             return false;