[
https://issues.apache.org/jira/browse/DIRMINA-625?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12648104#action_12648104
]
Vadim Lotarev commented on DIRMINA-625:
---------------------------------------
Sure. I am writing a client application and sometimes I need to wait
synchronously for server response. Below is the code I wrote for that (may be I
did something wrong - pleas advice). Please replace RegisterClientMessage by
anything else appropriate for your test sever. I do not use any thread model.
@Override
public void sessionOpened(IoSession session) throws Exception {
log.info(String.format("*** Connected to: %s. Local address used: %s",
session.getRemoteAddress()
.toString(), session.getLocalAddress().toString()));
// Send REGISTERCLIENT message
InetSocketAddress localAddress = (InetSocketAddress)
session.getLocalAddress();
RegisterClientMessage message = new RegisterClientMessage("",
localAddress.getAddress().getHostAddress(),
localAddress.getPort(),
localAddress.getAddress().getHostName());
session.getConfig().setUseReadOperation(true);
WriteFuture writeFuture = session.write(command);
writeFuture.awaitUninterruptibly();
ReadFuture readFuture = session.read();
readFuture.awaitUninterruptibly();
session.getConfig().setUseReadOperation(false);
}
Here is the log:
[2008-11-17 10:37:47,251] INFO *** Connected to: [...]. Local address
used:[...]
[2008-11-17 10:37:52,372] ERROR DEAD LOCK: IoFuture.await() was invoked from
an I/O processor thread. Please use IoFutureListener or configure a proper
thread model alternatively.
> How to use the function awaitUninterruptibly or await
> -----------------------------------------------------
>
> Key: DIRMINA-625
> URL: https://issues.apache.org/jira/browse/DIRMINA-625
> Project: MINA
> Issue Type: Bug
> Components: Core
> Affects Versions: 2.0.0-M3
> Reporter: ben
>
> Always reported abnormal DEAD LOCK, How to use it.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.