svn commit: r1141283 - in /ofbiz/trunk: applications/order/src/org/ofbiz/order/order/OrderServices.java framework/entity/src/org/ofbiz/entity/sql/EntitySelectPlan.java framework/entity/src/org/ofbiz/entity/transaction/TransactionUtil.java

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

svn commit: r1141283 - in /ofbiz/trunk: applications/order/src/org/ofbiz/order/order/OrderServices.java framework/entity/src/org/ofbiz/entity/sql/EntitySelectPlan.java framework/entity/src/org/ofbiz/entity/transaction/TransactionUtil.java

doogie-3
Author: doogie
Date: Wed Jun 29 22:12:02 2011
New Revision: 1141283

URL: http://svn.apache.org/viewvc?rev=1141283&view=rev
Log:
FEATURE: Add some doFooTransaction variants, that allow for the
transaction timeout to be specified, and deprecate the old ones.
Additionally, the Callable now comes first, as that is groovy
compatible.

Modified:
    ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderServices.java
    ofbiz/trunk/framework/entity/src/org/ofbiz/entity/sql/EntitySelectPlan.java
    ofbiz/trunk/framework/entity/src/org/ofbiz/entity/transaction/TransactionUtil.java

Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderServices.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderServices.java?rev=1141283&r1=1141282&r2=1141283&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderServices.java (original)
+++ ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderServices.java Wed Jun 29 22:12:02 2011
@@ -5594,7 +5594,7 @@ public class OrderServices {
         final EntityCondition cond = EntityCondition.makeCondition(orderCondList);
         List<String> orderIds;
         try {
-            orderIds = TransactionUtil.doNewTransaction("getSalesOrderIds", new Callable<List<String>>() {
+            orderIds = TransactionUtil.doNewTransaction(new Callable<List<String>>() {
                 public List<String> call() throws Exception {
                     List<String> orderIds = new LinkedList<String>();
                     EntityListIterator eli = null;
@@ -5611,7 +5611,7 @@ public class OrderServices {
                     }
                     return orderIds;
                 }
-            });
+            }, "getSalesOrderIds", 0, true);
         } catch (GenericEntityException e) {
             Debug.logError(e, module);
             return ServiceUtil.returnError(e.getMessage());

Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/sql/EntitySelectPlan.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/sql/EntitySelectPlan.java?rev=1141283&r1=1141282&r2=1141283&view=diff
==============================================================================
--- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/sql/EntitySelectPlan.java (original)
+++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/sql/EntitySelectPlan.java Wed Jun 29 22:12:02 2011
@@ -60,7 +60,7 @@ public final class EntitySelectPlan exte
     }
 
     public List<GenericValue> getAll(final Delegator delegator, final Map<String, ? extends Object> params) throws GenericEntityException {
-        return TransactionUtil.doTransaction("sql select", new Callable<List<GenericValue>>() {
+        return TransactionUtil.doTransaction(new Callable<List<GenericValue>>() {
             public List<GenericValue> call() throws Exception {
                 EntityListIterator it = null;
                 try {
@@ -70,7 +70,7 @@ public final class EntitySelectPlan exte
                     if (it != null) it.close();
                 }
             }
-        });
+        }, "sql select", 0, true);
     }
 
     public DynamicViewEntity getDynamicViewEntity() {

Modified: ofbiz/trunk/framework/entity/src/org/ofbiz/entity/transaction/TransactionUtil.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/framework/entity/src/org/ofbiz/entity/transaction/TransactionUtil.java?rev=1141283&r1=1141282&r2=1141283&view=diff
==============================================================================
--- ofbiz/trunk/framework/entity/src/org/ofbiz/entity/transaction/TransactionUtil.java (original)
+++ ofbiz/trunk/framework/entity/src/org/ofbiz/entity/transaction/TransactionUtil.java Wed Jun 29 22:12:02 2011
@@ -75,22 +75,34 @@ public class TransactionUtil implements
     private static ThreadLocal<Timestamp> transactionStartStamp = new ThreadLocal<Timestamp>();
     private static ThreadLocal<Timestamp> transactionLastNowStamp = new ThreadLocal<Timestamp>();
 
+    @Deprecated
     public static <V> V doNewTransaction(String ifErrorMessage, Callable<V> callable) throws GenericEntityException {
         return inTransaction(noTransaction(callable), ifErrorMessage, 0, true).call();
     }
 
+    @Deprecated
     public static <V> V doNewTransaction(String ifErrorMessage, boolean printException, Callable<V> callable) throws GenericEntityException {
         return inTransaction(noTransaction(callable), ifErrorMessage, 0, printException).call();
     }
 
+    public static <V> V doNewTransaction(Callable<V> callable, String ifErrorMessage, int timeout, boolean printException) throws GenericEntityException {
+        return inTransaction(noTransaction(callable), ifErrorMessage, timeout, printException).call();
+    }
+
+    @Deprecated
     public static <V> V doTransaction(String ifErrorMessage, Callable<V> callable) throws GenericEntityException {
         return inTransaction(callable, ifErrorMessage, 0, true).call();
     }
 
+    @Deprecated
     public static <V> V doTransaction(String ifErrorMessage, boolean printException, Callable<V> callable) throws GenericEntityException {
         return inTransaction(callable, ifErrorMessage, 0, printException).call();
     }
 
+    public static <V> V doTransaction(Callable<V> callable, String ifErrorMessage, int timeout, boolean printException) throws GenericEntityException {
+        return inTransaction(callable, ifErrorMessage, timeout, printException).call();
+    }
+
     public static <V> Callable<V> noTransaction(Callable<V> callable) {
         return new NoTransaction<V>(callable);
     }