From: <sc...@hy...> - 2009-12-04 05:14:04
|
Author: scottmf Date: 2009-12-03 21:13:49 -0800 (Thu, 03 Dec 2009) New Revision: 14028 URL: http://svn.hyperic.org/?view=rev&root=Hyperic+HQ&revision=14028 Modified: trunk/src/org/hyperic/hq/events/server/session/AlertDefinitionManagerEJBImpl.java Log: [HHQ-3534] changed method to print debugging info in a finally block just in case it times out and throws an exception Modified: trunk/src/org/hyperic/hq/events/server/session/AlertDefinitionManagerEJBImpl.java =================================================================== --- trunk/src/org/hyperic/hq/events/server/session/AlertDefinitionManagerEJBImpl.java 2009-12-03 22:38:33 UTC (rev 14027) +++ trunk/src/org/hyperic/hq/events/server/session/AlertDefinitionManagerEJBImpl.java 2009-12-04 05:13:49 UTC (rev 14028) @@ -795,38 +795,41 @@ final AlertDAO dao = getAlertDAO(); final AlertDefinitionDAO aDao = getAlertDefDAO(); final ActionDAO actionDAO = getActionDAO(); - for (final Iterator i = alertDefIds.iterator(); i.hasNext();) { - final Integer alertdefId = (Integer) i.next(); - final AlertDefinition alertdef = aDao.findById(alertdefId); + try { + for (final Iterator i = alertDefIds.iterator(); i.hasNext();) { + final Integer alertdefId = (Integer) i.next(); + final AlertDefinition alertdef = aDao.findById(alertdefId); - // Delete the alerts - if (debug) watch.markTimeBegin("deleteByAlertDefinition"); - dao.deleteByAlertDefinition(alertdef); - if (debug) watch.markTimeEnd("deleteByAlertDefinition"); + // Delete the alerts + if (debug) watch.markTimeBegin("deleteByAlertDefinition"); + dao.deleteByAlertDefinition(alertdef); + if (debug) watch.markTimeEnd("deleteByAlertDefinition"); - // Remove the conditions - if (debug) watch.markTimeBegin("remove conditions and triggers"); - alertdef.clearConditions(); - alertdef.getTriggersBag().clear(); - if (debug) watch.markTimeEnd("remove conditions and triggers"); + // Remove the conditions + if (debug) watch.markTimeBegin("remove conditions and triggers"); + alertdef.clearConditions(); + alertdef.getTriggersBag().clear(); + if (debug) watch.markTimeEnd("remove conditions and triggers"); - // Remove the actions - if (debug) watch.markTimeBegin("removeActions"); - actionDAO.removeActions(alertdef); - if (debug) watch.markTimeEnd("removeActions"); + // Remove the actions + if (debug) watch.markTimeBegin("removeActions"); + actionDAO.removeActions(alertdef); + if (debug) watch.markTimeEnd("removeActions"); - if (debug) watch.markTimeBegin("remove from parent"); - if (alertdef.getParent() != null) { - alertdef.getParent().getChildrenBag().remove(alertdef); + if (debug) watch.markTimeBegin("remove from parent"); + if (alertdef.getParent() != null) { + alertdef.getParent().getChildrenBag().remove(alertdef); + } + if (debug) watch.markTimeEnd("remove from parent"); + + // Actually remove the definition + if (debug) watch.markTimeBegin("remove"); + aDao.remove(alertdef); + if (debug) watch.markTimeEnd("remove"); } - if (debug) watch.markTimeEnd("remove from parent"); - - // Actually remove the definition - if (debug) watch.markTimeBegin("remove"); - aDao.remove(alertdef); - if (debug) watch.markTimeEnd("remove"); + } finally { + if (debug) log.debug("deleted " + alertDefIds.size() + " alertDefs: " + watch); } - if (debug) log.debug("deleted " + alertDefIds.size() + " alertDefs: " + watch); } /** Find an alert definition and return a value object |