Many programs must address the problem of handling a series of incoming requests. One simple concurrency strategy is the Thread-perPer-Message design pattern, which uses a new thread for each request [Lea 2000a]. This pattern is generally preferred over sequential executions of time-consuming, I/O-bound, session-based, or isolated tasks.
...
This noncompliant code example demonstrates the Thread-perPer-Message design pattern. The RequestHandler
class provides a public static factory method so that callers can obtain a RequestHandler
instance. The handleRequest()
method is subsequently invoked to handle each request in its own thread.
...