Ejemplo n.º 1
0
 /**
  * Close the given JMS QueueBrowser and ignore any thrown exception. This is useful for typical
  * <code>finally</code> blocks in manual JMS code.
  *
  * @param browser the JMS QueueBrowser to close (may be <code>null</code>)
  */
 public static void closeQueueBrowser(QueueBrowser browser) {
   if (browser != null) {
     try {
       browser.close();
     } catch (JMSException ex) {
       logger.trace("Could not close JMS QueueBrowser", ex);
     } catch (Throwable ex) {
       // We don't trust the JMS provider: It might throw RuntimeException or Error.
       logger.trace("Unexpected exception on closing JMS QueueBrowser", ex);
     }
   }
 }
Ejemplo n.º 2
0
 public Message getMessage() throws JMSException {
   if (message == null) {
     if (id != null) {
       QueueBrowser tempBrowser = getBrowser();
       Enumeration iter = tempBrowser.getEnumeration();
       while (iter.hasMoreElements()) {
         Message item = (Message) iter.nextElement();
         if (id.equals(item.getJMSMessageID())) {
           message = item;
           break;
         }
       }
       tempBrowser.close();
     }
   }
   return message;
 }