The ConcurrentServer class

The ConcurrentServer class needs some internal attributes to work properly:

  • A ParallelCache instance to use the cache system.
  • A ServerSocket instance to get connections from the clients.
  • A Boolean value to know when it has to stop its execution.
  • A LinkedBlockingQueue instance to store the sockets of the clients that send a message to the server. These sockets will be processed by the RequestTask class.
  • A ConcurrentHashMap to store the Future objects associated with every task executed in the executor. The key will be the username of the users that sends the queries, and the values will be another Map whose key will be the ConcurrenCommand objects and the value will be the Future instance associated with that task. ...

Get Mastering Concurrency Programming with Java 9 - Second Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.