Skip to content

Commit f546e2e

Browse files
committed
propagate all exceptions that occur in binary log client
1 parent 073532e commit f546e2e

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

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

+4-3
Original file line numberDiff line numberDiff line change
@@ -495,8 +495,9 @@ public void setThreadFactory(ThreadFactory threadFactory) {
495495
* @throws AuthenticationException if authentication fails
496496
* @throws ServerException if MySQL server responds with an error
497497
* @throws IOException if anything goes wrong while trying to connect
498+
* @throws IllegalStateException if binary log client is already connected
498499
*/
499-
public void connect() throws IOException {
500+
public void connect() throws IOException, IllegalStateException {
500501
if (!connectLock.tryLock()) {
501502
throw new IllegalStateException("BinaryLogClient is already connected");
502503
}
@@ -836,8 +837,8 @@ public void run() {
836837
try {
837838
setConnectTimeout(timeout);
838839
connect();
839-
} catch (IOException e) {
840-
exceptionReference.set(e);
840+
} catch (Exception e) {
841+
exceptionReference.set(new IOException(e)); // method is asynchronous, catch all exceptions so that they are not lost
841842
countDownLatch.countDown(); // making sure we don't end up waiting whole "timeout"
842843
}
843844
}

0 commit comments

Comments
 (0)