Concurency how to

24 views
Skip to first unread message

Victor S

unread,
Sep 24, 2015, 4:52:49 AM9/24/15
to quickserver
Hello

Thank you for this complex and easy to use library.
I have a question that may be simple.
I used the official example named CmdServer with small modifications - I added these lines in "public void handleCommand(ClientHandler handler, String command)" from class CmdCommandHandler
                    if(command.equals("test")) {
                       
System.err.println("Sleeping....");
                       
try {
                           
Thread.sleep(20000);
                       
} catch (InterruptedException ex) {
                           
Logger.getLogger(CmdCommandHandler.class.getName()).log(Level.SEVERE, null, ex);
                       
}                        
                   
} else {
                       
System.err.println("Not sleeping....");
                   
}
So when client sends command "test" the current thread will sleep for 20 seconds simulating a slow command.
I was expecting for the server to accept new connection in these 20 seconds but is not. Concurency doesn't seems to work.
What is wrong with my test?

Thank you

Reply all
Reply to author
Forward
Message has been deleted
Message has been deleted
0 new messages