Stopping a Server
The stop() member shuts down a server. This function does not wait for the server to shut down, it merely starts the process. Any thread that needs to know when a server has completed shutdown should use join() to wait for the server thread to exit.
Calling stop() to shut down a server pool causes the server pool thread to attempt to stop and join each of the runnable servers within the pool. Each runnable server only stops after completing execution of any enqueued runnables. Should a runnable server within the pool be deadlocked or running in an infinite loop, then the server pool never completes its shutdown, but still might be canceled by another thread.
NOTE: A server does not join with the runnables it starts, so threaded runnables passed to a server can continue to execute after the server has been shut down. It is your responsibility to join with any threaded runnables you pass to a runnable server.