How to handle long worker threads in enterprise environments
Coll开发者_如何学JAVAeague of mine contacted me asking if it is possible to stop HTTP workers if the request takes to long. I have to admit, I found the question quite odd, and really not befitting for a service-based environment, but it got me thinking.
If you have large requests that really can take a long time to complete (> 5 secs e.g.) how could you stop them when you want to avoid your server from being swamped?
For reference: I'm using Glassfish v2.1.1. But general helpful comments are also appreciated!
Timing out a http request is web container specific. For example for JBoss you can find more info here but if you expect that behavior it would be better to redesign your architecture to handle the calls asynchronously (maybe with MDB's)
精彩评论