title: Multithreaded server shared ArrayList
body: <p>I'm trying to implement a Multithreaded Server in Java where the server spawns a new thread for each client that connects to it. The communication is carried out in a class which implements the Runnable interface and takes the Socket descriptor as the input. When a new client connects, I spawn a new thread with the Socket descriptor number.</p>
  
  <p>I need to maintain two ArrayLists at the server which are updated whenever a new client joins the system (with some data that the client sends). How can I accomplish this behaviour of sharing an ArrayList among multiple clients running in different threads?</p>