• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

MQ : error while browsing queues

 
Ranch Hand
Posts: 87
Hibernate Firefox Browser Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi

I am trying browse a queue which has write only permissions and I am trying to catch an exception in catch block and print a message that the queus has only wite permissions in system log depending on the reason code.

try {

InitialContext ctx = new InitialContext();
qcf = (QueueConnectionFactory) ctx.lookup(qcfName);
queue = (Queue) ctx.lookup(queueName);
queueConnection = qcf.createQueueConnection();
queueSession = queueConnection.createQueueSession(false, Session.AUTO_ACKNOWLEDGE);
queueBrowser = queueSession.createBrowser(queue);
queueConnection.start();

Enumeration enum = queueBrowser.getEnumeration();
while (enum.hasMoreElements()) {
Message msg = (Message) enum.nextElement();
count++;
}
} catch (NamingException ne) {
........
} catch (JMSException jmse) {
.....

} catch (Exception e) {
............
} finally {
try {
queueBrowser.close();
} catch (Exception e) {
.............
}

Since the queue is not browsable when i say queueBrowser.getEnumerations should't it go to catch block . But in mycode it passes through the enumeration to finally block and close the browser.

Any help is apperiacitaed.

Thanks
Smitha
 
Vallaru smitha
Ranch Hand
Posts: 87
Hibernate Firefox Browser Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
bump up
 
Marshal
Posts: 79180
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Vallaru smitha wrote:bump up

Patience, patience.
 
Vallaru smitha
Ranch Hand
Posts: 87
Hibernate Firefox Browser Tomcat Server
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sorry, I can understand but I am kind of struck so i just bumbed up.

This is what I undestood enum always returns something eventhou the queue is not browsable .

Enumeration enum = queueBrowser.getEnumeration();

Could anyone please let me now if there way i could throw and catch when queue is not broswable.

Thanks
smitha
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic