From: <cl...@hy...> - 2008-12-10 06:43:13
|
Author: clee Date: 2008-12-09 22:43:07 -0800 (Tue, 09 Dec 2008) New Revision: 12012 URL: http://svn.hyperic.org/?view=rev&root=Hyperic+HQ&revision=12012 Modified: branches/HQ_4_0/src/org/hyperic/hq/bizapp/server/mdb/RegisteredDispatcherEJBImpl.java Log: Revert unintentional check-in Modified: branches/HQ_4_0/src/org/hyperic/hq/bizapp/server/mdb/RegisteredDispatcherEJBImpl.java =================================================================== --- branches/HQ_4_0/src/org/hyperic/hq/bizapp/server/mdb/RegisteredDispatcherEJBImpl.java 2008-12-10 06:40:53 UTC (rev 12011) +++ branches/HQ_4_0/src/org/hyperic/hq/bizapp/server/mdb/RegisteredDispatcherEJBImpl.java 2008-12-10 06:43:07 UTC (rev 12012) @@ -142,54 +142,51 @@ return; } - final boolean debug = log.isDebugEnabled(); - ObjectMessage om = (ObjectMessage) inMessage; - Object obj; + // Just to be safe, start with a fresh queue. + Messenger.resetThreadLocalQueue(); + final Set visitedMCTriggers = new HashSet(); + boolean debug = log.isDebugEnabled(); + try { - obj = om.getObject(); - + ObjectMessage om = (ObjectMessage) inMessage; + Object obj = om.getObject(); + if (debug) { - log.debug("Redelivering message=" + - inMessage.getJMSRedelivered()); + log.debug("Redelivering message="+inMessage.getJMSRedelivered()); } - } catch (JMSException e) { - log.error("Cannot open message object", e); - return; - } - - Collection events = new ArrayList(); - if (obj instanceof AbstractEvent) { - events.add(obj); - } else if (obj instanceof Collection) { - events.addAll((Collection) obj); - } - - while (events.size() > 0) { - // Just to be safe, start with a fresh queue. - Messenger.resetThreadLocalQueue(); - final Set visitedMCTriggers = new HashSet(); - - try { + + if (obj instanceof AbstractEvent) { + AbstractEvent event = (AbstractEvent) obj; + if (debug) { + log.debug("1 event in the message"); + } + + dispatchEvent(event, visitedMCTriggers); + } else if (obj instanceof Collection) { + Collection events = (Collection) obj; + + if (debug) { log.debug(events.size()+" events in the message"); } - + for (Iterator it = events.iterator(); it.hasNext(); ) { AbstractEvent event = (AbstractEvent) it.next(); dispatchEvent(event, visitedMCTriggers); - it.remove(); } - } catch (InterruptedException e) { - log.info("Thread was interrupted while processing events."); - } finally { - try { - flushStateForVisitedMCTriggers(visitedMCTriggers); - } catch (Exception e) { - log.error("Failed to flush state for multi condition trigger", e); - } - - dispatchEnqueuedEvents(); } + } catch (JMSException e) { + log.error("Cannot open message object", e); + } catch (InterruptedException e) { + log.info("Thread was interrupted while processing events."); + } finally { + try { + flushStateForVisitedMCTriggers(visitedMCTriggers); + } catch (Exception e) { + log.error("Failed to flush state for multi condition trigger", e); + } + + dispatchEnqueuedEvents(); } } |