Hello,

I am having a problem with a servlet, as described below:

My servlet collects up to two hours of data in a List.  When I do something
that causes my servlet zone to reload all of the servlets, I would prefer that
the servlet didn't have to start collecting its data from scratch.

To avoid this, in the destroy method I write out (serialize) the data List
to a file.  In the init method I read the data List back in if the file 
exists.

The basic code in the destroy method:

    os = new ObjectOutputStream(
           new GZIPOutputStream(
             new FileOutputStream(saveFile)));
    os.writeObject(installations);
    os.flush();

The basic code in the init method:

    is = new ObjectInputStream(
           new GZIPInputStream(
             new FileInputStream(saveFile)));
    installations = (List) is.readObject();

After Apache is restarted, the init method successfully reads in an existing
file.  If I do something that causes my servlet zone to reload all of the
servlets, the destroy method successfully writes out the file.  However, on the
next initialization, the init method seems to freeze on the readObject() line
(CPU usage drops to 0, and nothing more appears in the logs, suggesting that
the next line never gets executed).  I have to restart Apache - on the
subsequent init the file is read successfully, so I know it was written
properly in the destroy method.

Because this works once, I suspect that the problem is with Apache JServ, and
not with my code.  Does anyone have any idea why this is happening?

I'm using Apache 1.3.4 and Apache JServ 1.0b3 with Java 1.2 on Solaris 2.6.

Any help would be appreciated!  Thanks,

Harry
----------------------------------------------------------------------
Harry Blundell         SWI Systemware         URL:  http://www.swi.com
151 Eglinton Avenue West, Toronto ON  M4R 1A6, Canada
PHONE: (416) 481-9480 x6014  FAX: (416) 481-7059  EMAIL: [EMAIL PROTECTED]



----------------------------------------------------------------
To subscribe:        [EMAIL PROTECTED]
To unsubscribe:      [EMAIL PROTECTED]
Archives and Other:  <http://java.apache.org/main/mail.html/>
Problems?:           [EMAIL PROTECTED]

Reply via email to