Appendix AConcurrency II
This appendix supports and amplifies the Concurrency chapter on page 177. It is written as a series of independent topics and you can generally read them in any order. There is some duplication between sections to allow for such reading.
Client/Server Example
Imagine a simple client/server application. A server sits and waits listening on a socket for a client to connect. A client connects and sends a request.
The Server
Here is a simplified version of a server application. Full source for this example is available starting on page 343, Client/Server Nonthreaded.
ServerSocket serverSocket = new ServerSocket(8009); while (keepProcessing) { try { Socket ...
Get Clean Code: A Handbook of Agile Software Craftsmanship now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.