• Post Reply Bookmark Topic Watch Topic
  • New Topic

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

 
raminaa niilian
Ranch Hand
Posts: 551
  • Mark post as helpful
  • send pies
  • 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
 
Jeanne Boyarsky
author & internet detective
Sheriff
Posts: 36446
454
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • 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.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!