From fc5be1d0594f322013ef6adbcc04a7d55d65f59d Mon Sep 17 00:00:00 2001 From: manoj Date: Tue, 7 Apr 2015 19:15:03 +0530 Subject: [PATCH] Update operation rollback and commit --- .../mgt/core/operation/mgt/OperationManagerImpl.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/operation/mgt/OperationManagerImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/operation/mgt/OperationManagerImpl.java index 8f74a23549..610494b011 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/operation/mgt/OperationManagerImpl.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/operation/mgt/OperationManagerImpl.java @@ -145,11 +145,6 @@ public class OperationManagerImpl implements OperationManager { Operation operation = operationDAO.getNextOperation(deviceId); return operation; } catch (OperationManagementDAOException e) { - try { - OperationManagementDAOFactory.rollbackTransaction(); - } catch (OperationManagementDAOException e1) { - log.warn("Error occurred while roll-backing the transaction", e1); - } throw new OperationManagementException("Error occurred while retrieving next pending operation", e); } } @@ -164,6 +159,11 @@ public class OperationManagerImpl implements OperationManager { operationDAO.updateOperation(operation); OperationManagementDAOFactory.commitTransaction(); }catch(OperationManagementDAOException ex){ + try { + OperationManagementDAOFactory.rollbackTransaction(); + } catch (OperationManagementDAOException e1) { + log.warn("Error occurred while roll-backing the update operation transaction", e1); + } log.error("Error occurred while updating the operation: "+operationId); throw new OperationManagementException("Error occurred while update operation", ex); }