Hi,
This has been posted before, this time i have made it more thorough.

My top of my context inside my server.xml looks like: 

<Context path="/lawonline" docBase="lawonline" debug="0"
                 reloadable="false" crossContext="true">

my web.xml looks like:

<listener>
        <listener-class>
                com.lawonline.StartServlet
        </listener-class>
</listener>



The code in the listener:


 public void contextInitialized(ServletContextEvent sce)
 {
  sce.getServletContext().setAttribute("startServlet", this);
  System.out.println("Context Initialized");

  synchronized(this)
  {
   if(!hasBeenInitialized)
   {
    scheduler = Scheduler.getScheduler();
    System.out.println("The listener is: "+this);
    hasBeenInitialized = true;
   }
  }

  System.out.println("Got Scheduler Instance");
 }


When server start the listener starts up as expected. However upon the first request 2 
more instances are created straight away. Does anyne know what could cause this and 
furthermore how to rectify the situation. I only want ONE instance as multiple 
instances causes major concurrency issues. Thanks in advance

regards,
Dave






Reply via email to