mirror of
https://github.com/alibaba/canal.git
synced 2026-11-04 00:30:15 +08:00
使用netty重构socketChannel(jdk内置),修改了PacketManager实现,以及其他相关引用的类。
This commit is contained in:
@@ -139,8 +139,8 @@ public class MysqlConnection implements ErosaConnection {
|
||||
HeaderPacket binlogDumpHeader = new HeaderPacket();
|
||||
binlogDumpHeader.setPacketBodyLength(cmdBody.length);
|
||||
binlogDumpHeader.setPacketSequenceNumber((byte) 0x00);
|
||||
PacketManager.write(connector.getChannel(), new ByteBuffer[] { ByteBuffer.wrap(binlogDumpHeader.toBytes()),
|
||||
ByteBuffer.wrap(cmdBody) });
|
||||
PacketManager.write(connector.getChannel(), binlogDumpHeader.toBytes(),
|
||||
cmdBody);
|
||||
|
||||
connector.setDumping(true);
|
||||
}
|
||||
|
||||
@@ -5,11 +5,11 @@ import java.io.InterruptedIOException;
|
||||
import java.net.SocketTimeoutException;
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.channels.ClosedByInterruptException;
|
||||
import java.nio.channels.SocketChannel;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import com.alibaba.otter.canal.parse.driver.mysql.socket.SocketChannel;
|
||||
import com.taobao.tddl.dbsync.binlog.LogFetcher;
|
||||
|
||||
/**
|
||||
@@ -156,7 +156,7 @@ public class DirectLogFetcher extends LogFetcher {
|
||||
throw new IOException("Unexpected End Stream");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// for (int count, n = 0; n < len; n += count) {
|
||||
// if (0 > (count = input.read(buffer, off + n, len - n))) {
|
||||
// // Reached end of input stream
|
||||
|
||||
@@ -94,7 +94,6 @@ public class DirectLogFetcherTest {
|
||||
HeaderPacket binlogDumpHeader = new HeaderPacket();
|
||||
binlogDumpHeader.setPacketBodyLength(cmdBody.length);
|
||||
binlogDumpHeader.setPacketSequenceNumber((byte) 0x00);
|
||||
PacketManager.write(connector.getChannel(), new ByteBuffer[] { ByteBuffer.wrap(binlogDumpHeader.toBytes()),
|
||||
ByteBuffer.wrap(cmdBody) });
|
||||
PacketManager.write(connector.getChannel(), binlogDumpHeader.toBytes(),cmdBody);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user