Skip to content

Commit e59006e

Browse files
committed
Revert "Atomic processing of create/remove of keepalive thread"
This reverts commit 4680cb8 (caused shyiko#321).
1 parent d466f72 commit e59006e

File tree

1 file changed

+0
-16
lines changed

1 file changed

+0
-16
lines changed

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

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,6 @@ public X509Certificate[] getAcceptedIssuers() {
164164
private volatile ExecutorService keepAliveThreadExecutor;
165165

166166
private final Lock connectLock = new ReentrantLock();
167-
private final Lock keepAliveThreadExecutorLock = new ReentrantLock();
168167

169168
/**
170169
* Alias for BinaryLogClient("localhost", 3306, <no schema> = null, username, password).
@@ -771,8 +770,6 @@ public Thread newThread(Runnable runnable) {
771770
return newNamedThread(runnable, "blc-keepalive-" + hostname + ":" + port);
772771
}
773772
});
774-
try {
775-
keepAliveThreadExecutorLock.lock();
776773
threadExecutor.submit(new Runnable() {
777774
@Override
778775
public void run() {
@@ -813,9 +810,6 @@ public void run() {
813810
}
814811
});
815812
keepAliveThreadExecutor = threadExecutor;
816-
} finally {
817-
keepAliveThreadExecutorLock.unlock();
818-
}
819813
}
820814

821815
private Thread newNamedThread(Runnable runnable, String threadName) {
@@ -825,12 +819,7 @@ private Thread newNamedThread(Runnable runnable, String threadName) {
825819
}
826820

827821
boolean isKeepAliveThreadRunning() {
828-
try {
829-
keepAliveThreadExecutorLock.lock();
830822
return keepAliveThreadExecutor != null && !keepAliveThreadExecutor.isShutdown();
831-
} finally {
832-
keepAliveThreadExecutorLock.unlock();
833-
}
834823
}
835824

836825
/**
@@ -1180,8 +1169,6 @@ public void disconnect() throws IOException {
11801169
}
11811170

11821171
private void terminateKeepAliveThread() {
1183-
try {
1184-
keepAliveThreadExecutorLock.lock();
11851172
ExecutorService keepAliveThreadExecutor = this.keepAliveThreadExecutor;
11861173
if (keepAliveThreadExecutor == null) {
11871174
return;
@@ -1191,9 +1178,6 @@ private void terminateKeepAliveThread() {
11911178
Long.MAX_VALUE, TimeUnit.NANOSECONDS)) {
11921179
// ignore
11931180
}
1194-
} finally {
1195-
keepAliveThreadExecutorLock.unlock();
1196-
}
11971181
}
11981182

11991183
private static boolean awaitTerminationInterruptibly(ExecutorService executorService, long timeout, TimeUnit unit) {

0 commit comments

Comments
 (0)