Skip to content

Commit 5c911b6

Browse files
authored
Merge pull request osheroff#38 from elw00d/master
Introduce overridable setupConnection() method
2 parents 6fc750f + 532f474 commit 5c911b6

File tree

1 file changed

+15
-8
lines changed

1 file changed

+15
-8
lines changed

src/main/java/com/github/shyiko/mysql/binlog/BinaryLogClient.java

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -554,14 +554,7 @@ public void connect() throws IOException, IllegalStateException {
554554
}
555555
binlogPosition = 4;
556556
}
557-
ChecksumType checksumType = fetchBinlogChecksum();
558-
if (checksumType != ChecksumType.NONE) {
559-
confirmSupportOfChecksum(checksumType);
560-
}
561-
setMasterServerId();
562-
if (heartbeatInterval > 0) {
563-
enableHeartbeat();
564-
}
557+
setupConnection();
565558
gtid = null;
566559
tx = false;
567560
requestBinaryLogStream();
@@ -614,6 +607,20 @@ public void connect() throws IOException, IllegalStateException {
614607
}
615608
}
616609

610+
/**
611+
* Apply additional options for connection before requesting binlog stream.
612+
*/
613+
protected void setupConnection() throws IOException {
614+
ChecksumType checksumType = fetchBinlogChecksum();
615+
if (checksumType != ChecksumType.NONE) {
616+
confirmSupportOfChecksum(checksumType);
617+
}
618+
setMasterServerId();
619+
if (heartbeatInterval > 0) {
620+
enableHeartbeat();
621+
}
622+
}
623+
617624
private PacketChannel openChannel() throws IOException {
618625
Socket socket = socketFactory != null ? socketFactory.createSocket() : new Socket();
619626
socket.connect(new InetSocketAddress(hostname, port), (int) connectTimeout);

0 commit comments

Comments
 (0)