Singleton vs JNDI vs ?

Hey guys,

A question. In designing our application we needed a place to store a few arrays that never change, some setting that never change and some other stuff.

I'd initially thought of using a singleton for this purpose. This however messes up my plan of using one jar-file for several webapps running in the same VM. Once the first webapp would load, the singleton would be loaded and all webapps would be using one and the same instance.

So, I thought of using JNDI to store an instance of this object per webapp. Problem here is, it's so much of a hassle to get something from JNDI. You need to bind it there, catch exceptions when retrieving etc.etc.etc.

What are your thoughts on this topic?

[735 byte] By [sunseara] at [2007-9-28 12:29:57]
# 1
How about a variation of the singleton:give your getInstance a String parameter, to distinguishthe different users, depending on the parameter you get different instances.regardsSpieler
spielera at 2007-7-12 3:38:08 > top of Java-index,Other Topics,Patterns & OO Design...
# 2
****, good idea,I think log4j uses something like that right? Hmm this might just be what I needed.ThanksMartin van Dijken
sunseara at 2007-7-12 3:38:08 > top of Java-index,Other Topics,Patterns & OO Design...