tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "David Hemingway" <>
Subject Urgent problem with Singleton
Date Fri, 10 Jan 2003 00:49:35 GMT

I have a task scheduler thread that implements ServletContextListener and starts up as a listener
with the following code from my web.xml:


My problem is however I need this to be a singleton, its imperative. There always seems to
be about 3 threads created though. I have tried numerous things including making this servlet
call a singleton class to do the task scheduling but it still ends up with 3 threads. This
is causing terrible concurrency problems that wouldn't exist if this was working properly.
My serlvet code currently resembles the following:

boolean hasBeenInitialized = false; 

 public void contextInitialized(ServletContextEvent sce)
        //Start up the task scheduler thread
        hasBeenInitialized = true; 

I am using Tomcat 4.1.18, Apache 1.3.27 under RedHat 7.3. I didn't have this problem under
wn32 only Linux. Any help, or ideas on how I can get this to be a single instance would be
greatly appreciated. Thank you


  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message