I am writing a multi-thread program in Java, where i am creating a seperate thread to handle each new client connection. I have:
Socket s;
while(true)
{
    s = server.accept();
    ClientHandler ch = new ClientHandler(s);
    Thread servingThread = new Thread(ch);
    servingThread.start();
}
In the ClientHandler thread i have:
public class ClientHandler implements Runnable
{
    private Socket s;
public ClientHandler(Socket _Socket, boolean _accepted, BaseStation _bs)
{
    this.s = _Socket;
}
If in Java i can't pass an object but only a reference to it, isn't that going to cause a problem, to the s instance inside ClientHandler whenever server accepts a new connection?
Is it not going to change inside ClientHandler too and corrupt it? If so, what's the correct way to do it?
 
     
     
     
     
    