Re: Why no thread.sleep in servlet and a light way to poll from a servlet



anita wrote:
Hmm.. I read the spec again- it seems to imply that I CAN start my own
threads in a servlet container.

So maybe a TimerTask will do- or a simple Thread.sleep
I dont need to have it happen periodically or anything.
Just want the incoming request to poll a resource a couple of times
before giving up.

You are allowed to do it from a servlet.

If it is something only a single or few users are
doing it is also OK.

If many users will be doing it then you can get
problems with the server.

Why not do it another way like:
- have one request send a message to a message queue
- have a MDB process it
- have the client poll at a reasonable interval to a
servlet that checks if the work is done
?

I would think the container would prefer 3*N requests
that runs quick over N requests that each blocks for
seconds.

Arne
.



Relevant Pages

  • Re: Looking for advise: Multithreaded http requests
    ... The best way to do asynchrnous processing is to queue up the user's ... request in a database or a message queue and let the user know you'll ... >the provider responds and then makes request to the next ptovider in the row. ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Many threads in Linux
    ... parsing a line of text then sending a message to a message queue, ... If request processing involves some system calls or memory ...
    (comp.programming.threads)
  • Re: Threading with an object and Session
    ... the request and session, populate an object then put this object on a ...
    (microsoft.public.dotnet.framework.aspnet)