AFAIK servlets aren't designed to fulfill
long running tasks.
It is server specific after what period of time he
unloads a servlet.
Some unverified suggestions:
- Adjust the time for servlet unloading on your server
- overwrite your servlets 'destroy()' method and wait for
all threads to terminate
- output some blanks periodically on the HttpResponse while waiting
- Create some new requests to your servlet via servlet chaining
(this will prevent unloading of the servlets instance)
I don't know how long clients wait for a response before they timeout.
Hope that helps
Wolfgang Stein
-----Urspr�ngliche Nachricht-----
Von: JOSE ADRIANO BALTIERI [mailto:[EMAIL PROTECTED]]
Gesendet: Montag, 24. Januar 2000 13:57
An: [EMAIL PROTECTED]
Betreff: Sleeping at the service (method) !
Hello list
I'm needing to wait or sleep or yield during the service
method.
However, whenever I put a wait() in the middle of the service
method,
it seems that the transaction is interrupted and the browser receives an
empty document. It appears to me that the service method was abandoned.
Why do I need to do that ? Because the response is being
provided by
someone else, via a text file. So the servlet enters into a loop where
it will
wait for the existence of such a text file. If I don't signal the system
that
the servlet is idle, it will consume so much CPU that the benefits of
migrating from CGI to SERVLET as simply gone. This problem spoils all
the
advantages I could have from the migration.
I also checked this mailing list archives and it was said
before
that this is impossible to do.
As I can't believe it, I'm posting the question again.
So,
Is there a way to sleep during the service (method) ?
Could I use an external call to do that, say, a C program ?
Would
that be acceptable (I'd prefer to do it natively, I mean, inside Java
itself).
Thanks for any kind of colaboration !
Obrigado/Thanks a lot,
Jose Adriano Baltieri
Analista de Sistemas
CPD - CENTRO
UNIMEP - Universidade Metodista de
Piracicaba
PIRACICABA - SP - BRASIL
Fone : 055 019 430-1858 (english
spoken)
Fax : 055 019 430-1898 (Caixa Postal
42778)
________________________________________________________________________
___
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