hi

i need some help. my problem is the following:

i use a class caching files whilch I refer to in several servlets.
this one should be a singleton. to achive this, it is implemented like:

public class filecache{
 
 private static filecache myself = null;
 
 private filecache()
 {// do some init stuff
 }
 
 public filecache getInstance()
 {
  if (myself==null)
  { 
   myself=new filecache();
   System.err.println("I have been initialized !");
  }
  return myself;
 }
 
 ...
 
}

and in the servlets

public class testservlet
{
 private static filecache fc = null;
 
 public void init (ServletConfig c) throws ServletException
 {
  super.init(c);
  fc=filecache.getInstance();
 } 
 
 ...
}

Unfortunatly JServ obviously initializes one filecache now per
Servlet-Zone !?

in fact I see as many "I have been initialized !" as 
servlet-zones are defined.... hmmmm....

how to overcome this ?! i just want to have one filecache created per
VM.

hints ?!

MfG Uwe Schaefer
______________________________________________
Email: [EMAIL PROTECTED]




------------------------------------------------------------
To subscribe:    [EMAIL PROTECTED]
To unsubscribe:  [EMAIL PROTECTED]
Problems?:       [EMAIL PROTECTED]

Reply via email to