From fd6ddfcaae0aff5923cd3b8a07c6ffe0b1876b20 Mon Sep 17 00:00:00 2001 From: Andrew Zeneski Date: Mon, 21 May 2007 05:00:58 +0000 Subject: [PATCH] added transaction to index keywords (7200) git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@540027 13f79535-47bb-0310-9956-ffa450edef68 --- .../ofbiz/product/product/ProductEvents.java | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/applications/product/src/org/ofbiz/product/product/ProductEvents.java b/applications/product/src/org/ofbiz/product/product/ProductEvents.java index af7caaf491..507ab340d9 100644 --- a/applications/product/src/org/ofbiz/product/product/ProductEvents.java +++ b/applications/product/src/org/ofbiz/product/product/ProductEvents.java @@ -309,7 +309,10 @@ public class ProductEvents { int numProds = 0; int errProds = 0; + boolean beganTx = false; try { + // begin the transaction + beganTx = TransactionUtil.begin(7200); try { if (Debug.infoOn()) { long count = delegator.findCountByCondition("Product", condition, null); @@ -340,10 +343,20 @@ public class ProductEvents { } } } catch (GenericEntityException e) { + try { + TransactionUtil.rollback(beganTx, e.getMessage(), e); + } catch (Exception e1) { + Debug.logError(e1, module); + } return "error"; } catch (Throwable t) { Debug.logError(t, module); request.setAttribute("_ERROR_MESSAGE_", t.getMessage()); + try { + TransactionUtil.rollback(beganTx, t.getMessage(), t); + } catch (Exception e2) { + Debug.logError(e2, module); + } return "error"; } finally { if (entityListIterator != null) { @@ -353,6 +366,13 @@ public class ProductEvents { Debug.logError(gee, "Error closing EntityListIterator when indexing product keywords.", module); } } + + // commit the transaction + try { + TransactionUtil.commit(beganTx); + } catch (Exception e) { + Debug.logError(e, module); + } } if (errProds == 0) {