Application context, or application scope, is well-suited to this need too... the overhead should be at least a little bit less than JNDI (maybe not much, I've never benchmarked it) and you'll be able to access this data for all clients globally (i.e., any request, any session).

One caveat: I believe it's left to the app server to decide if app context is replicated across multiple nodes in a cluster, so if you're in such an environment then this might not be a good answer. Even multiple JVMs on the same server, I think, is still determined by the app server. I'm not sure what Tomcat does in this regard, but if you ever move to another app server you might find your application breaks if you have multiple nodes. For single server/JVM configurations it's not an issue though.

Frank

Dale Nesbitt wrote:
Not sure, maybe somebody else would know.  But if there is a performance
hit, it would be simple enough to just fetch the object once in your
init() method then keep a reference to it.

Pavan Singaraju wrote:
Thanks guys,
I have one more question. Using the JNDI, will it put any additional burden
on Tomcat webserver?? I mean performance wise?
--
Pavan S. Kumar

On 9/20/07, David Smith <[EMAIL PROTECTED]> wrote:
Another possibility is to store it in the ServletContext (ie application
scope) if it's just used on one webapp.

--David

Dale Nesbitt wrote:

I believe you can load any JavaBean using JNDI, and the bean will be
shared between all sessions in the context.

Pavan Singaraju wrote:


Hi,
  i have a design related question. I have to maintain some data common
to
all sessions. If one session updates the value in the data structure,
then
it should either updated in all the sessions / in the common data
structure.
Is there an approach i can go with?
--
Pavan S. Kumar


--
--
Frank W. Zammetti
Founder and Chief Software Architect
Omnytex Technologies
http://www.omnytex.com
AIM/Yahoo: fzammetti
MSN: [EMAIL PROTECTED]
Author of "Practical Ajax Projects With Java Technology"
 (2006, Apress, ISBN 1-59059-695-1)
and "JavaScript, DOM Scripting and Ajax Projects"
 (2007, Apress, ISBN 1-59059-816-4)
Java Web Parts - http://javawebparts.sourceforge.net
 Supplying the wheel, so you don't have to reinvent it!

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to