But with this multi-thread pool there can be pool-related deadlocks ,thread leakages too.and what about concurrency isssues, since they rely on wait() and notify() which can be tricky. How do the containers handle these?
Things are not as complex for the container as you think, for the extremely good reason that, each request Thread operates independently with its own objects for interpreting requests and creating responses.
The points of concurrency conflict are well known - for example database connections - but you the programmer have to handle them. The container may supply connection pools, etc but it is up to you to use them.
Thread leaks are possible as I know from my own mistakes. Beware of using the request Thread to access a resource that may hang indefinately.
Bill