@@ -794,17 +794,13 @@ public void run() {
794794 }
795795 }
796796 if (connectionLost ) {
797- if (logger .isLoggable (Level .INFO )) {
798- logger .info ("Trying to restore lost connection to " + hostname + ":" + port );
799- }
797+ logger .info ("Keepalive: Trying to restore lost connection to " + hostname + ":" + port );
800798 try {
801799 terminateConnect ();
802800 connect (connectTimeout );
803801 } catch (Exception ce ) {
804- if (logger .isLoggable (Level .WARNING )) {
805- logger .warning ("Failed to restore connection to " + hostname + ":" + port +
806- ". Next attempt in " + keepAliveInterval + "ms" );
807- }
802+ logger .warning ("keepalive: Failed to restore connection to " + hostname + ":" + port +
803+ ". Next attempt in " + keepAliveInterval + "ms" );
808804 }
809805 }
810806 }
@@ -1182,17 +1178,17 @@ private void terminateKeepAliveThread() {
11821178 try {
11831179 keepAliveThreadExecutorLock .lock ();
11841180 ExecutorService keepAliveThreadExecutor = this .keepAliveThreadExecutor ;
1185- if (keepAliveThreadExecutor == null ) {
1181+ if ( keepAliveThreadExecutor == null ) {
11861182 return ;
11871183 }
11881184 keepAliveThreadExecutor .shutdownNow ();
1189- while (!awaitTerminationInterruptibly (keepAliveThreadExecutor ,
1190- Long .MAX_VALUE , TimeUnit .NANOSECONDS )) {
1191- // ignore
1192- }
11931185 } finally {
11941186 keepAliveThreadExecutorLock .unlock ();
11951187 }
1188+ while (!awaitTerminationInterruptibly (keepAliveThreadExecutor ,
1189+ Long .MAX_VALUE , TimeUnit .NANOSECONDS )) {
1190+ // ignore
1191+ }
11961192 }
11971193
11981194 private static boolean awaitTerminationInterruptibly (ExecutorService executorService , long timeout , TimeUnit unit ) {
0 commit comments