提交 1e7b72aa 编写于 作者: C chidaodezhongsheng

fix bug, when run the TCL sql, the channel of netty will release back to the channel pool

上级 9b3fa4dd
......@@ -166,6 +166,9 @@ public final class NettyBackendHandler extends AbstractBackendHandler {
return new CommandResponsePackets(each);
}
}
if (SQLType.TCL == sqlStatement.getType()) {
channelRelease();
}
if (SQLType.DML == sqlStatement.getType()) {
return mergeDML(headPackets);
}
......@@ -207,11 +210,7 @@ public final class NettyBackendHandler extends AbstractBackendHandler {
@Override
public boolean next() throws SQLException {
if (null == mergedResult || !mergedResult.next()) {
for (Entry<String, List<Channel>> entry : channelMap.entrySet()) {
for (Channel each : entry.getValue()) {
BackendNettyClient.getInstance().getPoolMap().get(entry.getKey()).release(each);
}
}
channelRelease();
return false;
}
return true;
......@@ -225,4 +224,12 @@ public final class NettyBackendHandler extends AbstractBackendHandler {
}
return new ResultPacket(++currentSequenceId, data, columnCount, Collections.<ColumnType>emptyList());
}
private void channelRelease() {
for (Entry<String, List<Channel>> entry : channelMap.entrySet()) {
for (Channel each : entry.getValue()) {
BackendNettyClient.getInstance().getPoolMap().get(entry.getKey()).release(each);
}
}
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册