Seems you're sidestepping the real problem by trying to initialize with a doPost call ... the init() method is, afterall, meant for such initialization. ;) Won't you have the same problem is you hit the URL twice?
If there are two copies of your deamon thread starting, then the problem is in the code that starts them and can be changed to get the desired behavior. Before going into thoughts on that, is there anything non-basic about your setup that would complicate the problem (such as clustered Tomcats, multiple JVMs, or other code that can start this daemon)?
My apologies if you're absolutely sure you want to do this from a doPost(). (?!)
justin
At 04:29 PM 3/24/2003, you wrote:
I am having a problem with a daemon I want to create at startup. I have a singleton daemon that I used to load on startup in the init(ServletConfig) method of a servlet. The problem is that this ends up creating two versions that then run concurrently and duplicate everything they each are doing. So, I had to quite doing that and instead kickstart the daemon by putting it in doPost(HttpServletRequest, HttpServletResponse) instead. I am really not quite sure what the classloader issues are here.
I would like to kickstart the daemon on startup, because then I can avoid having to have clients get it going on their server with a call to http://localhost/kickstart where /kickstart is the mapping that calls the servlet with the daemon in doPost(HttpServletRequest, HttpServletResponse). Does someone have an idea. I am sure there are a lot of good ideas (there must be) but they are not coming to me immediately. I don't know that much about classloaders. I am not sure how the second version of the daemon is getting loaded, i.e. what other classloader is doing that. I know that each servlet has its own classloader. How that translates into the difference between init and doPost and the difference between startup of Tomcat and startup by call via doPost is dark to me.
I would just go read more intensively on classloaders, if I could know that was the way to solve this dilemma of my own making.
Thanks for any assistance on this.
Micael
____________________________________ Justin Ruthenbeck Software Engineer, NextEngine Inc. justinr - AT - nextengine DOT com Confidential See http://www.nextengine.com/confidentiality.php ____________________________________
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
