Hi Lee,
No I don't think that a servlet engine is allowed and can kill the running
background threads. My understanding is the the thread can be garbage
collected only if it's stopped and ( as all objects ) not referenced any
more from any other resource. There might some platforms though ... I'm
successfully using a logging background thread on WebLogic 4.03 ( JSDK 1.1 )
with the interservlet communication through ServletContex.getServlet() and
on NES4 ( JSDK 2.1 ) through ServletContex.setAttributre().
greetings
Jacek
> -----Original Message-----
> From: Lee Coomber [SMTP:[EMAIL PROTECTED]]
> Sent: Friday, October 29, 1999 03:18
> To: [EMAIL PROTECTED]
> Subject: Re: A long lived servlet
>
> Cheers Jacek
>
> Surely though, the thread would be garbage collected if the servlet is
> destroyed (which the engine is specifically allowed to do). I'm using
> JSDK2.0 (maybe should have mentioned that ;-) so I can't put the object in
> the ServletContext which I assume, lasts for the life of the engine.
>
> Lee
>
> At 11:32 28/10/99 -0700, you wrote:
> >One way to do it will be to create a background thread from the servlet
> >launched at startup. Then all servlets can communicate with this one
> using
> >shred objects ( either a static object, or via
> >ServleteContext().getServlet(), or via ServletContext()setAttribute(),
> >depending on taste and JSDK version ...).
> >
> >Jacek
> >
> >> -----Original Message-----
> >> From: Lee Coomber [SMTP:[EMAIL PROTECTED]]
> >> Sent: Thursday, October 28, 1999 09:58
> >> To: [EMAIL PROTECTED]
> >> Subject: A long lived servlet
> >>
> >> Hi
> >>
> >> I'm developing an application that requires a Java object (a logger) to
> >> run
> >> for the life of the servlet engine. Currently, I just use a daemon
> process
> >> but I would like to put it into a servlet so it is easily controllable
> via
> >> a web interface.
> >>
> >> Even if I define the servlet as a startup (I'm using JServ), the
> problem
> >> occurs with the API contract that allows the engine to destroy it at
> any
> >> time.
> >>
> >> Can anyone think of a 'legal' way of doing this without resorting to
> >> playing with the unix processes (or modifying JServ, it would be nice
> to
> >> be
> >> able to use it on JRun as well)?
> >>
> >> Many thanks for any answers,
> >>
> >> Lee
> >>
> >>
> >>
> >> [ > L A T E R A L * ~ ; ] - [ [EMAIL PROTECTED] ]
> >>
> >> Phone: +44 (0) 207 378 1011
> >> Fax: +44 (0) 207 403 4586
> >> Mobile: +44 (0) 7957 368 626
> >>
> >>
> __________________________________________________________________________
> >> _
> >> To unsubscribe, send email to [EMAIL PROTECTED] and include in the
> >> body
> >> of the message "signoff SERVLET-INTEREST".
> >>
> >> Archives: http://archives.java.sun.com/archives/servlet-interest.html
> >> Resources: http://java.sun.com/products/servlet/external-resources.html
> >> LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
> >
> >_________________________________________________________________________
> __
> >To unsubscribe, send email to [EMAIL PROTECTED] and include in the
> body
> >of the message "signoff SERVLET-INTEREST".
> >
> >Archives: http://archives.java.sun.com/archives/servlet-interest.html
> >Resources: http://java.sun.com/products/servlet/external-resources.html
> >LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
> >
>
> [ > L A T E R A L * ~ ; ] - [ [EMAIL PROTECTED] ]
>
> Phone: +44 (0) 207 378 1011
> Fax: +44 (0) 207 403 4586
> Mobile: +44 (0) 7957 368 626
>
> __________________________________________________________________________
> _
> To unsubscribe, send email to [EMAIL PROTECTED] and include in the
> body
> of the message "signoff SERVLET-INTEREST".
>
> Archives: http://archives.java.sun.com/archives/servlet-interest.html
> Resources: http://java.sun.com/products/servlet/external-resources.html
> LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html