hey guys,

i know this topic has been visited a few times in this forum. i did a quick 
search and i have read through all of them.  however, most seem to be pretty 
outdated (before 2002) and i would like to repost this topic to poll people's 
design pattern and choices.

i m currently using the latest and greatest of jboss (4.0.1) and i would like 
to do the following:

- read from a config datasource (could be a LDAP file or a db)
- do this on start up, and cache it somehow since it will be accessed many 
times.
- able to be referenced by any beans in jboss (my session beans, mainly) as 
well as my web-tier beans (servlets, etc).
- read only, no edit needed



the approach i have came up with (and this is open for critique, but be 
gentle.. =) is to have serviceMBean to start off by initializing a singleton 
class that will do the logic of loading the configuration file.  i can then use 
this singleton anywhere and can be put into tree-cache if i end up clustering 
my jboss servers.  but this solution doesnt seem elegant and i m not even sure 
if web-tier classes can access serviceMBean.

my questions are as follows:
1. is there a more elegant way to do this?  i dont like singletons, especially 
in j2ee since they are pretty odd in a distributed, multi-apps environment.  
but it doesnt seem like there is any other way

2. can i register this singleton as a jndi resource?  that way, both ejb-tier 
and web-tier classes can access this singleton.

3. can serviceMBean be access by web-tier classes?  if so, then i can just make 
the serviceMBean the "singleton" class. 

4.  what is the performance penality for accessing serviceMBean methods (since 
i will access these pretty often, throughout my code)?

5. is there a more efficient way of caching these config values so that i can 
access these variables without too much performance penalty?  

if anyone can give me more direction/critique to my design, or can suggest a 
better one, that would be awesome.

any comments are also welcome.

thanks.

View the original post : 
http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3866587#3866587

Reply to the post : 
http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=3866587


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
JBoss-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jboss-user

Reply via email to