multi-server and threads
GooD Evening every one ;
I have a problem and I hope that some one can help me..
I write a class named Server which has an inner class named ClientServerThread .. Now, I want to create multiple servers in the main but that execute the first statement only .. e.g.
Server x = new Server(int serverId);
Server y = new Server(int serverId);
Can I find any reason for that , or any alternative solutions..?!
I hope that clear..
So your Server class isn't doing anything? All you did was call its constructor. What does the constructor do? If you want to do something with the inner class, like start a thread against it, the constructor could do that.
However, if all you Server class is doing is starting a thread against an inner class, the inner class is unnecessary. Simplify your design by moving the inner class logic to Server and getting rid of the inner class. Or, I could have guessed wrong ;-)
Thank you steve11235 for your answer,
I think I'm understand your point, my outer class has an instructor that wait for a client and start a thread, the inner class contains the method run to do the operating..