Thanks for your response Stan.
You have a very valid question!
Are you looking to do more than just catch IOException and abandon that client? The server can't reconnect or anything useful, can it?
========================================================================
A little more background: I have a processor that may take while to process the client request and may be running in a different
thread and sending "heart-beat" messages to the client till the processing is completed. On completion of the process, a response is sent to the client.
Task on client disconnection: If I detect client disconnection, I just need to inform the processor to abandon the processing of this request. Additionally, I log the Socket & port that got closed (which is not possible if an IOException is thrown -unless I store these info upfront, when the client connects), cancel the respective SelectionKey, close the SocketChannel etc.
The real issue: If I only get an IOException with a variety of messages, how do I programmatically figure out what happened? Doing a
String comaprison of the actual message, may not work with any change in JDK version and is also considered to be a bad practice- Effective
Java by Joshua Bloch (Chapter 8)!
Any suggestion would help.
Thanks again,
Ram Chandramouli