I think sharing a common class across servlets can get tricky... I've never
tried it using Tomcats intrinsic technology, but I think if you if you want
to go this way then read up on
the ServletContextListener. Lets you look at what other servlets are up to,
so you could make something that looks at servlet 1 and if it hasnt made the
common resource then, servlet 2 will make it... then when servlet 1 starts
it checks servlet 2, see's its already running and uses that.... mmmmmm I
dont like it, think code could get very messy.
What I do for for this kind stuff is use Harbor....
So I would make the shared class, dump it in the Harbor servlet and then
call it from other servlets... Harbor is a very lite application server. I
wrote Harbor and I'm keen to test it on this sort of application, so if you
care to give me the test code of your shared object, I make 2 servlets and
show you how to share the object across all your servlets.... even if they
run on different machines. If you interested have a look at
http://coolese.100free.com/
regards,
Johnny
----- Original Message -----
From: "James Sherwood" <[EMAIL PROTECTED]>
To: "Tomcat Users List" <users@tomcat.apache.org>
Sent: Friday, March 30, 2007 4:19 PM
Subject: Static class across multiple tomcats?
Hello,
What I am trying to do is to have a thread running to check a database for
something at a certian time.
All is well but when we launch both tomcats, there are 2 threads running
and I cannot figure out how to have only 1 thread running as it seams
static classes are unique to each tomcat.
Any ideas?
Thanks,
James
---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]