MINA is lacking a set of exceptions to properly inform the user about what is
going on
--------------------------------------------------------------------------------------
Key: DIRMINA-889
URL: https://issues.apache.org/jira/browse/DIRMINA-889
Project: MINA
Issue Type: Improvement
Affects Versions: 2.0.4
Reporter: Alex C.
following scenario:
A MINA powered server application is reading data from network, which is sent
by any client. While server is getting data, the connection get's broken. The
read() from server is interrupted and exceptionCaught() in IoHandler is called.
Currently, my exceptionCaught() implementation looks like this:
----
@Override
public void exceptionCaught(IoSession session, Throwable throwable) throws
Exception {
logger.error("exception Caught. session={}. Exception:\n {}", new
Object[]{Utils.longToHexString(session.getId()),
Utils.getStackTraceAsString(throwable)});
logger.debug("Closing the session now! session={}",
Utils.longToHexString(session.getId()));
session.close(true);
}
----
Problem is, that I don't know how to differentiate between "real and important
exceptions", which need to be logged more prominent and exception which might
occur because of a client has been disconnected correctly (broken network
connection). if a connection get's broken, I just get a generic IOException:
----
Feb 21, 2012 5:10:20 PM de.root1.simon.Dispatcher exceptionCaught
Schwerwiegend: exception Caught. session=0x00000002. Exception:
java.io.IOException: Die Verbindung wurde vom Kommunikationspartner
zurückgesetzt
at sun.nio.ch.FileDispatcherImpl.read0(Native Method)
at sun.nio.ch.SocketDispatcher.read(SocketDispatcher.java:39)
at sun.nio.ch.IOUtil.readIntoNativeBuffer(IOUtil.java:218)
at sun.nio.ch.IOUtil.read(IOUtil.java:191)
at sun.nio.ch.SocketChannelImpl.read(SocketChannelImpl.java:359)
at org.apache.mina.transport.socket.nio.NioProcessor.read(NioProcessor.java:280)
at org.apache.mina.transport.socket.nio.NioProcessor.read(NioProcessor.java:44)
at
org.apache.mina.core.polling.AbstractPollingIoProcessor.read(AbstractPollingIoProcessor.java:695)
at
org.apache.mina.core.polling.AbstractPollingIoProcessor.process(AbstractPollingIoProcessor.java:668)
at
org.apache.mina.core.polling.AbstractPollingIoProcessor.process(AbstractPollingIoProcessor.java:657)
at
org.apache.mina.core.polling.AbstractPollingIoProcessor.access$600(AbstractPollingIoProcessor.java:68)
at
org.apache.mina.core.polling.AbstractPollingIoProcessor$Processor.run(AbstractPollingIoProcessor.java:1141)
at
org.apache.mina.util.NamePreservingRunnable.run(NamePreservingRunnable.java:64)
at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
at java.lang.Thread.run(Thread.java:722)
----
There should be some MINA exceptions handling (f.i. in this special scenario a
kihd of "UnexpectedlyClosedConnectionException" or so) this kind of problems,
so that one can differentiate the exceptions in "exceptionCaught" to know what
really happened somewhere deep in MINA.
Alternatively, there could be some error-codes. But would really prefer the
solution with the MINA exceptions ...
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira