Skip to content

Commit c544bc0

Browse files
committed
I'm dumb.
1 parent fee145c commit c544bc0

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

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

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1175,13 +1175,16 @@ public void disconnect() throws IOException {
11751175
}
11761176

11771177
private void terminateKeepAliveThread() {
1178-
keepAliveThreadExecutorLock.lock();
1179-
ExecutorService keepAliveThreadExecutor = this.keepAliveThreadExecutor;
1180-
if (keepAliveThreadExecutor == null) {
1181-
return;
1178+
try {
1179+
keepAliveThreadExecutorLock.lock();
1180+
ExecutorService keepAliveThreadExecutor = this.keepAliveThreadExecutor;
1181+
if ( keepAliveThreadExecutor == null ) {
1182+
return;
1183+
}
1184+
keepAliveThreadExecutor.shutdownNow();
1185+
} finally {
1186+
keepAliveThreadExecutorLock.unlock();
11821187
}
1183-
keepAliveThreadExecutor.shutdownNow();
1184-
keepAliveThreadExecutorLock.unlock();
11851188
while (!awaitTerminationInterruptibly(keepAliveThreadExecutor,
11861189
Long.MAX_VALUE, TimeUnit.NANOSECONDS)) {
11871190
// ignore

0 commit comments

Comments
 (0)