-
Book Overview & Buying
-
Table Of Contents
Learning Network Programming with Java
By :
The chief advantage of a multithreaded server is that long-running client requests will not block the server from accepting other client requests. If a new thread is not created, then the current request will be processed. It is only after the request has been processed that new requests can be accepted. Using a separate thread for a request means that connections and their associated requests can be processed concurrently.
When using a multithreaded server, there are several of ways of configuring the threads as follows:
Thread-per-request
Thread-per-connection
Thread-per-object
In the thread-per-request model, each request that arrives at the server is assigned a new thread. While this is a simple approach, it can result in the creation of a large number of threads. In addition, each request will often mean that a new connection will be created.
This model works nicely in an environment where the previous client request does not need to be retained. For example...
Change the font size
Change margin width
Change background colour