I am working on a simple message queue where I am creating separate thread for new connection. I want to know which variables are accessible and can be modified by multiple threads.
class RequestHandler implements Runnable {
Socket socket;
protected RequestHandler(Socket socket) {
this.socket = socket;
}
public void run() { ..........
In above code is socket can be accessed by multiple threads, if yes then how do I protect it.
Complete code is available at. https://github.com/nakshay/JQueue
I am new to multithreading, please modify question if requried.