I have a client server methodology in which I am using javaServerSocket connection to act as a server which will always looking for client request. This server will be running in a specified port like 4444, 4445,etc..,. I don't know how to stop that server because I am unable to take the ServerSocket instance running on port. So to achieve server stopping, I used to kill the process abruptly but this is not a proper way of stopping the server the server since my server is handling N number client requests concurrently and middle of the process if I kill this, tasks which is being handled by all the threads will go off. I am using ArrayBlockingQueue for queuing up the client requests. currently I am having 100 of Max thread pool size. Can any one help me out regarding this?
Sample piece of code:
to start the server :
Please help me to stop the server by giving running port number. My applicaiton is running in sun solaris server.