You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by ja...@apache.org on 2007/09/21 23:03:04 UTC

svn commit: r578273 - /ofbiz/trunk/framework/service/src/org/ofbiz/service/semaphore/ServiceSemaphore.java

Author: jaz
Date: Fri Sep 21 14:03:03 2007
New Revision: 578273

URL: http://svn.apache.org/viewvc?rev=578273&view=rev
Log:
uses nested trys 

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

Modified: ofbiz/trunk/framework/service/src/org/ofbiz/service/semaphore/ServiceSemaphore.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/service/src/org/ofbiz/service/semaphore/ServiceSemaphore.java?rev=578273&r1=578272&r2=578273&view=diff
==============================================================================
--- ofbiz/trunk/framework/service/src/org/ofbiz/service/semaphore/ServiceSemaphore.java (original)
+++ ofbiz/trunk/framework/service/src/org/ofbiz/service/semaphore/ServiceSemaphore.java Fri Sep 21 14:03:03 2007
@@ -7,10 +7,13 @@
 import org.ofbiz.entity.GenericEntityException;
 import org.ofbiz.entity.GenericValue;
 import org.ofbiz.entity.transaction.GenericTransactionException;
+import org.ofbiz.entity.transaction.GenericXaResource;
 import org.ofbiz.entity.transaction.TransactionUtil;
 import org.ofbiz.service.ModelService;
 
 import javax.transaction.Transaction;
+import javax.transaction.xa.Xid;
+import javax.transaction.xa.XAException;
 import java.sql.Timestamp;
 import java.util.Map;
 
@@ -146,24 +149,25 @@
                 Debug.logError(e, module);
                 isError = true;
                 throw new SemaphoreFailException("Cannot obtain unique transaction for semaphore logging");
-            }
-        } catch (GenericTransactionException e) {
-            Debug.logError(e, module);
-        } finally {
-            if (isError) {
-                try {
-                    TransactionUtil.rollback(beganTx, "ServiceSemaphore: dbWrite()", new Exception());
-                } catch (GenericTransactionException e) {
-                    Debug.logError(e, module);
+            } finally {
+                if (isError) {
+                    try {
+                        TransactionUtil.rollback(beganTx, "ServiceSemaphore: dbWrite()", new Exception());
+                    } catch (GenericTransactionException e) {
+                        Debug.logError(e, module);
+                    }
                 }
-            }
-            if (!isError && beganTx) {
-                try {
-                    TransactionUtil.commit(beganTx);
-                } catch (GenericTransactionException e) {
-                    Debug.logError(e, module);
+                if (!isError && beganTx) {
+                    try {
+                        TransactionUtil.commit(beganTx);
+                    } catch (GenericTransactionException e) {
+                        Debug.logError(e, module);
+                    }
                 }
             }
+        } catch (GenericTransactionException e) {
+            Debug.logError(e, module);
+        } finally {            
             if (parent != null) {
                 try {
                     TransactionUtil.resume(parent);