fixed bio socket

This commit is contained in:
七锋
2018-03-15 20:20:29 +08:00
parent 28ad12d0ea
commit af002f4e24
2 changed files with 4 additions and 4 deletions

View File

@@ -2,12 +2,12 @@ package com.alibaba.otter.canal.parse.driver.mysql.socket;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.io.InterruptedIOException;
import java.io.OutputStream; import java.io.OutputStream;
import java.net.Socket; import java.net.Socket;
import java.net.SocketAddress; import java.net.SocketAddress;
import java.net.SocketException; import java.net.SocketException;
import java.net.SocketTimeoutException; import java.net.SocketTimeoutException;
import java.nio.channels.ClosedByInterruptException;
/** /**
* 使用BIO进行dump * 使用BIO进行dump
@@ -56,7 +56,7 @@ public class BioSocketChannel implements SocketChannel {
} }
} catch (SocketTimeoutException te) { } catch (SocketTimeoutException te) {
if (Thread.interrupted()) { if (Thread.interrupted()) {
throw new InterruptedIOException("Interrupted while reading."); throw new ClosedByInterruptException("Interrupted while reading.");
} }
} }
} }
@@ -81,7 +81,7 @@ public class BioSocketChannel implements SocketChannel {
} }
} catch (SocketTimeoutException te) { } catch (SocketTimeoutException te) {
if (Thread.interrupted()) { if (Thread.interrupted()) {
throw new InterruptedIOException("Interrupted while reading."); throw new ClosedByInterruptException();
} }
accTimeout += SO_TIMEOUT; accTimeout += SO_TIMEOUT;
} }

View File

@@ -56,7 +56,7 @@ public class AbstractCanalClientTest {
context_format += "****************************************************" + SEP; context_format += "****************************************************" + SEP;
row_format = SEP row_format = SEP
+ "----------------> binlog[{}:{}] , name[{},{}] , eventType : {} , executeTime : {}({}) , delay : {}ms" + "----------------> binlog[{}:{}] , name[{},{}] , eventType : {} , executeTime : {}({}) , delay : {} ms"
+ SEP; + SEP;
transaction_format = SEP + "================> binlog[{}:{}] , executeTime : {}({}) , delay : {}ms" + SEP; transaction_format = SEP + "================> binlog[{}:{}] , executeTime : {}({}) , delay : {}ms" + SEP;