File tree Expand file tree Collapse file tree 2 files changed +10
-3
lines changed
main/java/com/github/shyiko/mysql/binlog
test/java/com/github/shyiko/mysql/binlog Expand file tree Collapse file tree 2 files changed +10
-3
lines changed Original file line number Diff line number Diff 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 }
Original file line number Diff line number Diff line change @@ -833,6 +833,12 @@ public void testExceptionIsThrownWhenTryingToConnectAlreadyConnectedClient() thr
833833 client .connect ();
834834 }
835835
836+ @ Test (expectedExceptions = IOException .class )
837+ public void testExceptionIsThrownWhenTryingToConnectAlreadyConnectedClientWithTimeout () throws Exception {
838+ assertTrue (client .isConnected ());
839+ client .connect (1000 );
840+ }
841+
836842 @ Test
837843 public void testExceptionIsThrownWhenProvidedWithWrongCredentials () throws Exception {
838844 BinaryLogClient binaryLogClient =
You can’t perform that action at this time.
0 commit comments