modified the method addClient() to synchronized