Thursday, November 24, 2005 06:57 AM
Your servlet's service() method (I assume that is the method you wish to do your heavy-duty thread-blocking processing on) is called by the ServletContainer.
Although officially vendor-specific, all vendors I know do this by some sort of thread pool.
Therefore, you can block your servlet's methods, provided that:
- there are enough 'free' threads in the pool to service new, incoming requests for this or other servlets (this can usually be tuned/configured).
- you block the service() method short enough so the browser does not assume a timeout.
Blocking the 'main' thread is just blocking the 'main' thread the VM created to run your program in (i.e. the program does not exit until main is finished). So in short, your program just keeps running.