dcsimg
Static vs Singleton Initialization of IntialContext and JMSFactory
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   java_coder
Posted On:   Saturday, September 9, 2006 06:32 AM

If my application is deployed on a server like weblogic and it uses foreign JMS Server, TIBCO in my case, to get JMS Connections etc. Let's say Application consists of 20 modules in total, and 3 of them rely on shared instances of JMSFactory and InitialContext. What, in your view, is the best way to initialize these objects and keep them alive for the scope of application ? Static Initialization If I put intialization of these objects in static inilializers then the application would keep them alive even if these are not required but the benefit is that we would immediately know at deployment time that JMS Server, ( TIBCO), is not responding or down etc. Singleton Constrctor Other option is initia   More>>

If my application is deployed on a server like weblogic and it uses foreign JMS Server, TIBCO in my case, to get JMS Connections etc. Let's say Application consists of 20 modules in total, and 3 of them rely on shared instances of JMSFactory and InitialContext.

What, in your view, is the best way to initialize these objects and keep them alive for the scope of application ?


Static Initialization
If I put intialization of these objects in static inilializers then the application would keep them alive even if these are not required but the benefit is that we would immediately know at deployment time that JMS Server, ( TIBCO), is not responding or down etc.


Singleton Constrctor
Other option is initializing them in constructor of Singleton when first time a request is made; and then keeping them alive forever by putting a null check and renewing if found null.

   <<Less
About | Sitemap | Contact