Skip to content

Commit

Permalink
fix the 'ClosedChannelException' error when the client set useServerP…
Browse files Browse the repository at this point in the history
…repStmts=true (actiontech#1133)

* fix the 'ClosedChannelException' error when the client set
useServerPrepStmts=true

* other tweak

other tweak
  • Loading branch information
yinyanghuafa authored and yanhuqing666 committed Apr 18, 2019
1 parent 7b67ad5 commit 8fa21b0
Showing 1 changed file with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ public class FrontendCommandHandler implements NIOHandler {
protected final FrontendConnection source;
protected final CommandCount commands;
private volatile byte[] dataTodo;
Queue<byte[]> blobDataQueue = new ConcurrentLinkedQueue<byte[]>();
private Queue<byte[]> blobDataQueue = new ConcurrentLinkedQueue<byte[]>();

public FrontendCommandHandler(FrontendConnection source) {
FrontendCommandHandler(FrontendConnection source) {
this.source = source;
this.commands = source.getProcessor().getCommands();
}
Expand All @@ -49,8 +49,13 @@ public void handle(byte[] data) {
}

if (MySQLPacket.COM_STMT_SEND_LONG_DATA == data[4]) {
commands.doStmtSendLongData();
blobDataQueue.offer(data);
return;
} else if (MySQLPacket.COM_STMT_CLOSE == data[4]) {
commands.doStmtClose();
source.stmtClose(data);
return;
} else {
dataTodo = data;
if (MySQLPacket.COM_STMT_RESET == data[4]) {
Expand Down Expand Up @@ -113,10 +118,6 @@ protected void handleData(byte[] data) {
commands.doStmtExecute();
source.stmtExecute(data, blobDataQueue);
break;
case MySQLPacket.COM_STMT_CLOSE:
commands.doStmtClose();
source.stmtClose(data);
break;
case MySQLPacket.COM_HEARTBEAT:
commands.doHeartbeat();
source.heartbeat(data);
Expand Down

0 comments on commit 8fa21b0

Please sign in to comment.