java - How to add feature of "SHUTDOWN" in MultiThreaded Http Web Server code -


i writing http thread-pooled web server code. made code @ best. works fine also.

but there 1 problem, whenever want shut down server, have use ctrl + c. bad way shut down.

i think lot, add shutdown feature in code. unable that.

please me add feature, give suggestion that, code that.

edit no. 1

one method think make 1 thread listening stdin input given keyboard. whenever gets "shutdown". calls threadpol.shutdown(). way can achieve goal.

is right method ? if yes, please me implement this.

you can

threadpoolexecuto.shutdownnow()

attempts stop actively executing tasks, halts processing of waiting tasks, , returns list of tasks awaiting execution.


Comments