/**
* 使用channel进行数据发送
*
* @param ch
* @param responseClazz
* @param pbrpcMsg
* @return
*/
protected <T extends GeneratedMessage> CallFuture<T> doAsyncTransport(Channel ch,
Class<T> responseClazz, PbrpcMsg pbrpcMsg) {
if (ch != null) {
int uuid = IdGenerator.genUUID();
pbrpcMsg.setLogId(uuid);
CallFuture<T> future = CallFuture.newInstance();
CallbackPool.put(uuid, this.readTimeout, this.isShortAliveConn, ch, responseClazz,
future);
ch.writeAndFlush(pbrpcMsg);
LOG.debug("Send message " + pbrpcMsg + " done");
return future;
} else {
LOG.error("Socket channel is not well established, so failed to transport on "
+ getInfo());
throw new PbrpcConnectionException(
"Socket channel is not well established,so failed to transport on " + getInfo());
}
}
SimplePbrpcClient.java 文件源码
java
阅读 35
收藏 0
点赞 0
评论 0
项目:navi-pbrpc
作者:
评论列表
文章目录