[
https://issues.apache.org/jira/browse/DIRMINA-456?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12535690
]
Mike Heath commented on DIRMINA-456:
------------------------------------
Good call Heath . You were spot on with everything running in the same thread.
(Cool name BTW. :) )
Consider the following example:
public static void main(String[] args) throws IOException {
NioSocketAcceptor acceptor = new
NioSocketAcceptor(Executors.newCachedThreadPool());
acceptor.getFilterChain().addLast("executor", new
ExecutorFilter(Executors.newCachedThreadPool()));
acceptor.setHandler(new IoHandlerAdapter() {
@Override
public void messageReceived(IoSession session, Object
message) throws Exception {
session.write(IoBuffer.wrap("Have a nice
day\n".getBytes()));
Thread.sleep(2000);
session.write(IoBuffer.wrap("MINA makes me
happy\n".getBytes()));
Thread.sleep(2000);
session.write(IoBuffer.wrap("I like cold
beverages\n".getBytes()));
}
});
acceptor.setLocalAddress(new InetSocketAddress(1995));
acceptor.bind();
}
The above code works just fine. If you comment out the executor filter, all
the writes are done at once after waiting 4000ms.
However, if you comment out the executor filter and then append
.awaitUninterruptibly(), the server stalls indefinitely.
So the question is, do we put something in the await methods that checks to see
if the await is being called in the I/O thread the await is dependent on and
throw a dead-lock exception? Is there away that we can execute the desired
action from the await methods instead of blocking in this case?
> Provide mechanism for flushing writeBuffer from IoHandler.messageReceived
> -------------------------------------------------------------------------
>
> Key: DIRMINA-456
> URL: https://issues.apache.org/jira/browse/DIRMINA-456
> Project: MINA
> Issue Type: Improvement
> Components: Core
> Affects Versions: 2.0.0-M1
> Reporter: Mike Heath
> Fix For: 2.0.0-M1
>
>
> As described in this thread http://tinyurl.com/3cwkb3, we need to provide
> support for flushing the session's write queue from the
> IoHandler.messageRecieved() method.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.