mirror of
https://github.com/alibaba/canal.git
synced 2026-11-04 00:30:15 +08:00
dump connection is disconnected
dump connection is disconnected since SocketChannel.cache is overflow.
This commit is contained in:
@@ -27,10 +27,22 @@ public class SocketChannel {
|
||||
this.channel = channel;
|
||||
}
|
||||
|
||||
public void writeCache(ByteBuf buf) {
|
||||
public void writeCache(ByteBuf buf) throws InterruptedException {
|
||||
synchronized (lock) {
|
||||
while (true) {
|
||||
cache.discardReadBytes();// 回收内存
|
||||
cache.writeBytes(buf);
|
||||
//source buffer is empty.
|
||||
if (!buf.isReadable()) {
|
||||
break;
|
||||
}
|
||||
|
||||
if (cache.isWritable()) {
|
||||
cache.writeBytes(buf, Math.min(cache.writableBytes(), buf.readableBytes()));
|
||||
} else {
|
||||
//dest buffer is full.
|
||||
lock.wait(100);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user