• 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

is it good practice to initialize a ConnectionFactory in a servlet and save in JNDI?

 
Ranch Hand
Posts: 551
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi
Thank you for reading my post
we have an standalone client which use some JMS facilities of our application server.
each time that standalone client starts, it take about 20 seconds to get a connection factory from application server to create jms connection and session and...
Now i thought that maybe we could create a servlet which load on application server start (serverside application start) and create the connection factory and then store that connection factory into JNDI, from now on, the client application will not need to create a jms connection factory and it can retrieve the factory from the JNDI.

is it a good practice?

thanks
 
author & internet detective
Posts: 41860
908
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It is a good practice to do initialization on server startup through a servlet.

I don't see why you would need to put the resource in the JNDI though. You could just store it in a static variable to keep a reference to it. This would be easier to access than going to the JNDI.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic