Avoid unnecessary db connection

merge-requests/541/head
Charitha Goonetilleke 5 years ago
parent f59242d6b8
commit 9280810b24

@ -289,12 +289,11 @@ public class MonitoringManagerImpl implements MonitoringManager {
PolicyManagementDAOFactory.closeConnection();
}
if (!firstTimeComplianceData.isEmpty()) {
try {
PolicyManagementDAOFactory.beginTransaction();
if (!firstTimeComplianceData.isEmpty()) {
monitoringDAO.addComplianceDetails(firstTimeComplianceData);
PolicyManagementDAOFactory.commitTransaction();
}
} catch (MonitoringDAOException e) {
PolicyManagementDAOFactory.rollbackTransaction();
throw new PolicyComplianceException("Error occurred from monitoring dao.", e);
@ -304,6 +303,7 @@ public class MonitoringManagerImpl implements MonitoringManager {
} finally {
PolicyManagementDAOFactory.closeConnection();
}
}
if (!notifiableDeviceEnrollments.isEmpty()) {
try {

Loading…
Cancel
Save