This is an automated email from the ASF dual-hosted git repository.

sijie pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/bookkeeper.git


The following commit(s) were added to refs/heads/master by this push:
     new 979de4b  Always reset interrupted state after catching 
InterruptedException
979de4b is described below

commit 979de4b17b9ed9e734b8973cb211d9754c0788d1
Author: Ivan Kelly <iv...@apache.org>
AuthorDate: Tue Feb 20 11:41:07 2018 -0800

    Always reset interrupted state after catching InterruptedException
    
    There's many places we did not do it. I've added it.
    
    Author: Ivan Kelly <iv...@apache.org>
    
    Reviewers: Enrico Olivelli <eolive...@gmail.com>, Sijie Guo 
<si...@apache.org>
    
    This closes #1189 from ivankelly/interrupt-thread
---
 .../benchmark/BenchReadThroughputLatency.java      |  2 +-
 .../benchmark/BenchThroughputLatency.java          |  5 ++++-
 .../apache/bookkeeper/benchmark/TestClient.java    |  3 +++
 .../bookkeeper/common/util/OrderedScheduler.java   |  1 +
 .../bookkeeper/http/vertx/VertxHttpServer.java     |  6 +++++-
 .../java/org/apache/bookkeeper/bookie/Bookie.java  |  2 ++
 .../org/apache/bookkeeper/bookie/EntryLogger.java  |  1 +
 .../java/org/apache/bookkeeper/bookie/Journal.java |  3 +++
 .../bookie/ScanAndCompareGarbageCollector.java     |  1 +
 .../bookie/storage/ldb/DbLedgerStorage.java        |  1 +
 .../apache/bookkeeper/client/BookKeeperAdmin.java  |  5 ++++-
 .../apache/bookkeeper/client/BookieInfoReader.java |  1 +
 .../bookkeeper/discover/ZKRegistrationClient.java  |  2 ++
 .../bookkeeper/discover/ZKRegistrationManager.java | 24 ++++++++++++++++++----
 .../meta/LegacyHierarchicalLedgerManager.java      |  1 +
 .../bookkeeper/meta/LongZkLedgerIdGenerator.java   |  3 +++
 .../bookkeeper/meta/MSLedgerManagerFactory.java    |  1 +
 .../apache/bookkeeper/proto/BookieNettyServer.java |  2 ++
 .../org/apache/bookkeeper/proto/BookieServer.java  |  1 +
 .../bookkeeper/proto/ReadEntryProcessor.java       |  1 +
 .../org/apache/bookkeeper/replication/Auditor.java |  1 +
 .../bookkeeper/replication/AuditorElector.java     |  1 +
 .../bookkeeper/replication/AutoRecoveryMain.java   |  1 +
 .../bookkeeper/replication/ReplicationWorker.java  |  1 +
 .../sasl/SASLBookieAuthProviderFactory.java        |  1 +
 .../bookkeeper/sasl/SASLClientProviderFactory.java |  1 +
 .../apache/bookkeeper/sasl/TGTRefreshThread.java   |  3 +++
 .../java/org/apache/bookkeeper/server/Main.java    |  1 +
 .../server/http/BKHttpServiceProvider.java         | 10 ++++++---
 .../shims/zk/ZooKeeperServerShimImpl.java          |  1 +
 .../java/org/apache/bookkeeper/util/HardLink.java  |  4 ++++
 .../apache/bookkeeper/util/LocalBookKeeper.java    |  4 ++++
 .../java/org/apache/bookkeeper/util/Shell.java     |  2 ++
 .../bookkeeper/zookeeper/ZooKeeperClient.java      |  1 +
 .../bookkeeper/bookie/BookieShutdownTest.java      |  2 ++
 .../bookie/SortedLedgerStorageCheckpointTest.java  |  1 +
 .../storage/ldb/DbLedgerStorageWriteCacheTest.java |  1 +
 .../bookie/storage/ldb/WriteCacheTest.java         |  5 ++++-
 .../BookKeeperClientTestsWithBookieErrors.java     |  1 +
 .../client/BookKeeperClientZKSessionExpiry.java    |  1 +
 .../apache/bookkeeper/client/LedgerCloseTest.java  |  3 +++
 .../client/ParallelLedgerRecoveryTest.java         |  2 ++
 .../client/TestReadLastConfirmedAndEntry.java      |  2 ++
 .../org/apache/bookkeeper/meta/GcLedgersTest.java  |  2 ++
 .../bookkeeper/meta/LedgerManagerIteratorTest.java |  2 ++
 .../MetastoreTableAsyncToSyncConverter.java        |  1 +
 .../proto/TestPerChannelBookieClient.java          |  1 +
 .../replication/BookieLedgerIndexTest.java         |  1 +
 .../TestLedgerUnderreplicationManager.java         |  1 +
 .../apache/bookkeeper/test/AsyncLedgerOpsTest.java |  1 +
 .../apache/bookkeeper/test/BookieFailureTest.java  |  1 +
 .../bookkeeper/test/BookieReadWriteTest.java       | 11 ++++++++++
 .../bookkeeper/test/MultipleThreadReadTest.java    |  1 +
 .../distributedlog/common/util/SchedulerUtils.java |  1 +
 .../apache/distributedlog/BookKeeperClient.java    |  2 ++
 .../apache/distributedlog/LocalDLMEmulator.java    |  1 +
 .../apache/distributedlog/LogSegmentMetadata.java  |  2 ++
 .../distributedlog/ReadAheadEntryReader.java       |  1 +
 .../apache/distributedlog/auditor/DLAuditor.java   |  1 +
 .../distributedlog/bk/LedgerAllocatorPool.java     |  2 ++
 .../distributedlog/bk/SimpleLedgerAllocator.java   |  1 +
 .../distributedlog/impl/BKNamespaceDriver.java     |  1 +
 .../distributedlog/impl/ZKLogMetadataStore.java    |  1 +
 .../impl/ZKLogSegmentMetadataStore.java            |  1 +
 .../distributedlog/impl/ZKMetadataAccessor.java    |  2 ++
 .../distributedlog/impl/ZKNamespaceWatcher.java    |  1 +
 .../distributedlog/impl/acl/ZKAccessControl.java   |  4 ++++
 .../impl/acl/ZKAccessControlManager.java           |  2 ++
 .../federated/FederatedZKLogMetadataStore.java     |  5 +++++
 .../impl/metadata/ZKLogStreamMetadataStore.java    |  5 +++++
 .../impl/metadata/ZkMetadataResolver.java          |  1 +
 .../subscription/ZKSubscriptionStateStore.java     |  1 +
 .../impl/subscription/ZKSubscriptionsStore.java    |  1 +
 .../injector/RandomDelayFailureInjector.java       |  1 +
 .../apache/distributedlog/lock/ZKSessionLock.java  |  1 +
 .../apache/distributedlog/metadata/DLMetadata.java |  2 ++
 .../java/org/apache/distributedlog/util/Utils.java |  8 ++++++++
 .../apache/distributedlog/zk/ZKTransaction.java    |  1 +
 .../apache/distributedlog/zk/ZKWatcherManager.java |  1 +
 .../distributedlog/TestBKLogSegmentWriter.java     |  1 +
 .../TestNonBlockingReadsMultiReader.java           |  1 +
 .../apache/distributedlog/TestZooKeeperClient.java |  1 +
 .../distributedlog/lock/TestZKSessionLock.java     |  1 +
 83 files changed, 180 insertions(+), 12 deletions(-)

diff --git 
a/bookkeeper-benchmark/src/main/java/org/apache/bookkeeper/benchmark/BenchReadThroughputLatency.java
 
b/bookkeeper-benchmark/src/main/java/org/apache/bookkeeper/benchmark/BenchReadThroughputLatency.java
index a55ff04..750984f 100644
--- 
a/bookkeeper-benchmark/src/main/java/org/apache/bookkeeper/benchmark/BenchReadThroughputLatency.java
+++ 
b/bookkeeper-benchmark/src/main/java/org/apache/bookkeeper/benchmark/BenchReadThroughputLatency.java
@@ -121,7 +121,7 @@ public class BenchReadThroughputLatency {
                 Thread.sleep(1000);
             }
         } catch (InterruptedException ie) {
-            // ignore
+            Thread.currentThread().interrupt();
         } catch (Exception e) {
             LOG.error("Exception in reader", e);
         } finally {
diff --git 
a/bookkeeper-benchmark/src/main/java/org/apache/bookkeeper/benchmark/BenchThroughputLatency.java
 
b/bookkeeper-benchmark/src/main/java/org/apache/bookkeeper/benchmark/BenchThroughputLatency.java
index d9de4ac..d0f5ec7 100644
--- 
a/bookkeeper-benchmark/src/main/java/org/apache/bookkeeper/benchmark/BenchThroughputLatency.java
+++ 
b/bookkeeper-benchmark/src/main/java/org/apache/bookkeeper/benchmark/BenchThroughputLatency.java
@@ -147,6 +147,7 @@ public class BenchThroughputLatency implements AddCallback, 
Runnable {
                         }
                     } catch (InterruptedException ie) {
                         LOG.info("Caught interrupted exception, going away");
+                        Thread.currentThread().interrupt();
                     }
                 }
             };
@@ -162,6 +163,7 @@ public class BenchThroughputLatency implements AddCallback, 
Runnable {
                     LOG.info("Time to send first batch: {}s {}ns ", time / 
1000 / 1000 / 1000, time);
                 }
             } catch (InterruptedException e) {
+                Thread.currentThread().interrupt();
                 break;
             }
 
@@ -188,6 +190,7 @@ public class BenchThroughputLatency implements AddCallback, 
Runnable {
             }
         } catch (InterruptedException e) {
             LOG.error("Interrupted while waiting", e);
+            Thread.currentThread().interrupt();
         }
         synchronized (this) {
             duration = System.currentTimeMillis() - start;
@@ -198,7 +201,7 @@ public class BenchThroughputLatency implements AddCallback, 
Runnable {
         try {
             reporter.join();
         } catch (InterruptedException ie) {
-            // ignore
+            Thread.currentThread().interrupt();
         }
         LOG.info("Finished processing in ms: " + getDuration() + " tp = " + 
throughput);
     }
diff --git 
a/bookkeeper-benchmark/src/main/java/org/apache/bookkeeper/benchmark/TestClient.java
 
b/bookkeeper-benchmark/src/main/java/org/apache/bookkeeper/benchmark/TestClient.java
index 49f98a7..cf8b780 100644
--- 
a/bookkeeper-benchmark/src/main/java/org/apache/bookkeeper/benchmark/TestClient.java
+++ 
b/bookkeeper-benchmark/src/main/java/org/apache/bookkeeper/benchmark/TestClient.java
@@ -180,6 +180,7 @@ public class TestClient {
             LOG.error("I/O exception during benchmark", ioe);
         } catch (InterruptedException ie) {
             LOG.error("Benchmark interrupted", ie);
+            Thread.currentThread().interrupt();
         } finally {
             if (bkc != null) {
                 try {
@@ -188,6 +189,7 @@ public class TestClient {
                     LOG.error("Error closing bookkeeper client", bke);
                 } catch (InterruptedException ie) {
                     LOG.warn("Interrupted closing bookkeeper client", ie);
+                    Thread.currentThread().interrupt();
                 }
             }
         }
@@ -280,6 +282,7 @@ public class TestClient {
                 LOG.error("Exception in worker thread", e);
                 return 0L;
             } catch (InterruptedException ie) {
+                Thread.currentThread().interrupt();
                 LOG.error("Exception in worker thread", ie);
                 return 0L;
             }
diff --git 
a/bookkeeper-common/src/main/java/org/apache/bookkeeper/common/util/OrderedScheduler.java
 
b/bookkeeper-common/src/main/java/org/apache/bookkeeper/common/util/OrderedScheduler.java
index efc9df8..76dd375 100644
--- 
a/bookkeeper-common/src/main/java/org/apache/bookkeeper/common/util/OrderedScheduler.java
+++ 
b/bookkeeper-common/src/main/java/org/apache/bookkeeper/common/util/OrderedScheduler.java
@@ -216,6 +216,7 @@ public class OrderedScheduler {
                     }
                 }).get();
             } catch (InterruptedException e) {
+                Thread.currentThread().interrupt();
                 throw new RuntimeException("Couldn't start thread " + i, e);
             } catch (ExecutionException e) {
                 throw new RuntimeException("Couldn't start thread " + i, e);
diff --git 
a/bookkeeper-http/vertx-http-server/src/main/java/org/apache/bookkeeper/http/vertx/VertxHttpServer.java
 
b/bookkeeper-http/vertx-http-server/src/main/java/org/apache/bookkeeper/http/vertx/VertxHttpServer.java
index 635d24c..26c07e8 100644
--- 
a/bookkeeper-http/vertx-http-server/src/main/java/org/apache/bookkeeper/http/vertx/VertxHttpServer.java
+++ 
b/bookkeeper-http/vertx-http-server/src/main/java/org/apache/bookkeeper/http/vertx/VertxHttpServer.java
@@ -84,7 +84,10 @@ public class VertxHttpServer implements HttpServer {
             } else {
                 LOG.error("Failed to start org.apache.bookkeeper.http server 
on port {}", port, asyncResult.cause());
             }
-        } catch (InterruptedException | ExecutionException e) {
+        } catch (InterruptedException ie) {
+            Thread.currentThread().interrupt();
+            LOG.error("Failed to start org.apache.bookkeeper.http server on 
port {}", port, ie);
+        } catch (ExecutionException e) {
             LOG.error("Failed to start org.apache.bookkeeper.http server on 
port {}", port, e);
         }
         return false;
@@ -106,6 +109,7 @@ public class VertxHttpServer implements HttpServer {
         try {
             shutdownLatch.await();
         } catch (InterruptedException e) {
+            Thread.currentThread().interrupt();
             LOG.error("Interrupted while shutting down 
org.apache.bookkeeper.http server");
         }
     }
diff --git 
a/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/Bookie.java 
b/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/Bookie.java
index a3d1247..7b28cdd 100644
--- a/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/Bookie.java
+++ b/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/Bookie.java
@@ -944,6 +944,7 @@ public class Bookie extends BookieCriticalThread {
             }
             LOG.info("Journal thread(s) quit.");
         } catch (InterruptedException ie) {
+            Thread.currentThread().interrupt();
             LOG.warn("Interrupted on running journal thread : ", ie);
         }
         // if the journal thread quits due to shutting down, it is ok
@@ -1035,6 +1036,7 @@ public class Bookie extends BookieCriticalThread {
                 registrationManager.close();
             }
         } catch (InterruptedException ie) {
+            Thread.currentThread().interrupt();
             LOG.error("Interrupted during shutting down bookie : ", ie);
         } catch (Exception e) {
             LOG.error("Got Exception while trying to shutdown Bookie", e);
diff --git 
a/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/EntryLogger.java 
b/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/EntryLogger.java
index 112a602..df72899 100644
--- 
a/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/EntryLogger.java
+++ 
b/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/EntryLogger.java
@@ -620,6 +620,7 @@ public class EntryLogger {
                         } catch (CancellationException ce) {
                             throw new IOException("Task to allocate a new 
entry log is cancelled.", ce);
                         } catch (InterruptedException ie) {
+                            Thread.currentThread().interrupt();
                             throw new IOException("Intrrupted when waiting a 
new entry log to be allocated.", ie);
                         }
                     }
diff --git 
a/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/Journal.java 
b/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/Journal.java
index fc1c80c..146a83e 100644
--- a/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/Journal.java
+++ b/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/Journal.java
@@ -493,6 +493,7 @@ public class Journal extends BookieCriticalThread 
implements CheckpointSource {
                     LOG.error("I/O exception in ForceWrite thread", ioe);
                     running = false;
                 } catch (InterruptedException e) {
+                    Thread.currentThread().interrupt();
                     LOG.error("ForceWrite thread interrupted", e);
                     // close is idempotent
                     if (null != req) {
@@ -1078,6 +1079,7 @@ public class Journal extends BookieCriticalThread 
implements CheckpointSource {
         } catch (IOException ioe) {
             LOG.error("I/O exception in Journal thread!", ioe);
         } catch (InterruptedException ie) {
+            Thread.currentThread().interrupt();
             LOG.warn("Journal exits when shutting down", ie);
         } finally {
             // There could be packets queued for forceWrite on this logFile
@@ -1111,6 +1113,7 @@ public class Journal extends BookieCriticalThread 
implements CheckpointSource {
             this.join();
             LOG.info("Finished Shutting down Journal thread");
         } catch (InterruptedException ie) {
+            Thread.currentThread().interrupt();
             LOG.warn("Interrupted during shutting down journal : ", ie);
         }
     }
diff --git 
a/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/ScanAndCompareGarbageCollector.java
 
b/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/ScanAndCompareGarbageCollector.java
index 60ed34d..5f22d07 100644
--- 
a/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/ScanAndCompareGarbageCollector.java
+++ 
b/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/ScanAndCompareGarbageCollector.java
@@ -205,6 +205,7 @@ public class ScanAndCompareGarbageCollector implements 
GarbageCollector{
                 try {
                     zk.close();
                 } catch (InterruptedException e) {
+                    Thread.currentThread().interrupt();
                     LOG.error("Error closing zk session", e);
                 }
                 zk = null;
diff --git 
a/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/storage/ldb/DbLedgerStorage.java
 
b/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/storage/ldb/DbLedgerStorage.java
index 59d2b1b..b2e9e3d 100644
--- 
a/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/storage/ldb/DbLedgerStorage.java
+++ 
b/bookkeeper-server/src/main/java/org/apache/bookkeeper/bookie/storage/ldb/DbLedgerStorage.java
@@ -367,6 +367,7 @@ public class DbLedgerStorage implements 
CompactableLedgerStorage {
             }
 
         } catch (InterruptedException e) {
+            Thread.currentThread().interrupt();
             throw new IOException("Interrupted when adding entry " + ledgerId 
+ "@" + entryId);
         } finally {
             writeCacheMutex.writeLock().unlock();
diff --git 
a/bookkeeper-server/src/main/java/org/apache/bookkeeper/client/BookKeeperAdmin.java
 
b/bookkeeper-server/src/main/java/org/apache/bookkeeper/client/BookKeeperAdmin.java
index a723884..dcface6 100644
--- 
a/bookkeeper-server/src/main/java/org/apache/bookkeeper/client/BookKeeperAdmin.java
+++ 
b/bookkeeper-server/src/main/java/org/apache/bookkeeper/client/BookKeeperAdmin.java
@@ -1510,7 +1510,10 @@ public class BookKeeperAdmin implements AutoCloseable {
                 }
             }
             return false;
-        } catch (InterruptedException | ExecutionException e) {
+        } catch (InterruptedException ie) {
+            Thread.currentThread().interrupt();
+            throw new RuntimeException(ie);
+        } catch (ExecutionException e) {
             if (e.getCause() != null
                     && 
e.getCause().getClass().equals(BKException.BKNoSuchLedgerExistsException.class))
 {
                 LOG.debug("Ledger: {} has been deleted", ledgerId);
diff --git 
a/bookkeeper-server/src/main/java/org/apache/bookkeeper/client/BookieInfoReader.java
 
b/bookkeeper-server/src/main/java/org/apache/bookkeeper/client/BookieInfoReader.java
index 7147d6c..7639703 100644
--- 
a/bookkeeper-server/src/main/java/org/apache/bookkeeper/client/BookieInfoReader.java
+++ 
b/bookkeeper-server/src/main/java/org/apache/bookkeeper/client/BookieInfoReader.java
@@ -432,6 +432,7 @@ public class BookieInfoReader {
         try {
             latch.await();
         } catch (InterruptedException e) {
+            Thread.currentThread().interrupt();
             LOG.error("Received InterruptedException ", e);
             throw e;
         }
diff --git 
a/bookkeeper-server/src/main/java/org/apache/bookkeeper/discover/ZKRegistrationClient.java
 
b/bookkeeper-server/src/main/java/org/apache/bookkeeper/discover/ZKRegistrationClient.java
index 6633d9c..237809a 100644
--- 
a/bookkeeper-server/src/main/java/org/apache/bookkeeper/discover/ZKRegistrationClient.java
+++ 
b/bookkeeper-server/src/main/java/org/apache/bookkeeper/discover/ZKRegistrationClient.java
@@ -239,6 +239,7 @@ public class ZKRegistrationClient implements 
RegistrationClient {
                 zke.fillInStackTrace();
                 throw zke;
             } catch (InterruptedException e) {
+                Thread.currentThread().interrupt();
                 throw new BKInterruptedException();
             }
             this.ownZKHandle = true;
@@ -259,6 +260,7 @@ public class ZKRegistrationClient implements 
RegistrationClient {
             try {
                 zk.close();
             } catch (InterruptedException e) {
+                Thread.currentThread().interrupt();
                 log.warn("Interrupted on closing zookeeper client", e);
             }
         }
diff --git 
a/bookkeeper-server/src/main/java/org/apache/bookkeeper/discover/ZKRegistrationManager.java
 
b/bookkeeper-server/src/main/java/org/apache/bookkeeper/discover/ZKRegistrationManager.java
index a4ecdd6..e1c5c0c 100644
--- 
a/bookkeeper-server/src/main/java/org/apache/bookkeeper/discover/ZKRegistrationManager.java
+++ 
b/bookkeeper-server/src/main/java/org/apache/bookkeeper/discover/ZKRegistrationManager.java
@@ -134,7 +134,10 @@ public class ZKRegistrationManager implements 
RegistrationManager {
 
         try {
             this.zk = newZookeeper(conf, listener);
-        } catch (InterruptedException | KeeperException | IOException e) {
+        } catch (InterruptedException ie) {
+            Thread.currentThread().interrupt();
+            throw new MetadataStoreException(ie);
+        } catch (KeeperException | IOException e) {
             throw new MetadataStoreException(e);
         }
 
@@ -205,6 +208,7 @@ public class ZKRegistrationManager implements 
RegistrationManager {
             try {
                 zk.close();
             } catch (InterruptedException e) {
+                Thread.currentThread().interrupt();
                 log.warn("Interrupted on closing zookeeper client", e);
             }
         }
@@ -267,6 +271,7 @@ public class ZKRegistrationManager implements 
RegistrationManager {
             throw new IOException("ZK exception checking and wait ephemeral 
znode "
                     + regPath + " expired", ke);
         } catch (InterruptedException ie) {
+            Thread.currentThread().interrupt();
             log.error("Interrupted checking and wait ephemeral znode {} 
expired : ", regPath, ie);
             throw new IOException("Interrupted checking and wait ephemeral 
znode "
                     + regPath + " expired", ie);
@@ -297,6 +302,7 @@ public class ZKRegistrationManager implements 
RegistrationManager {
             // exit here as this is a fatal error.
             throw new MetadataStoreException(ke);
         } catch (InterruptedException ie) {
+            Thread.currentThread().interrupt();
             log.error("Interrupted exception registering ephemeral Znode for 
Bookie!", ie);
             // Throw an IOException back up. This will cause the Bookie
             // constructor to error out. Alternatively, we could do a System
@@ -348,7 +354,10 @@ public class ZKRegistrationManager implements 
RegistrationManager {
     private void doUnregisterBookie(String regPath) throws BookieException {
         try {
             zk.delete(regPath, -1);
-        } catch (InterruptedException | KeeperException e) {
+        } catch (InterruptedException ie) {
+            Thread.currentThread().interrupt();
+            throw new MetadataStoreException(ie);
+        } catch (KeeperException e) {
             throw new MetadataStoreException(e);
         }
     }
@@ -381,7 +390,10 @@ public class ZKRegistrationManager implements 
RegistrationManager {
                     cookieData.getValue(),
                     (int) ((LongVersion) 
cookieData.getVersion()).getLongVersion());
             }
-        } catch (InterruptedException | KeeperException e) {
+        } catch (InterruptedException ie) {
+            Thread.currentThread().interrupt();
+            throw new MetadataStoreException("Interrupted writing cookie for 
bookie " + bookieId, ie);
+        } catch (KeeperException e) {
             throw new MetadataStoreException("Failed to write cookie for 
bookie " + bookieId);
         }
     }
@@ -409,7 +421,10 @@ public class ZKRegistrationManager implements 
RegistrationManager {
             zk.delete(zkPath, (int) ((LongVersion) version).getLongVersion());
         } catch (NoNodeException e) {
             throw new CookieNotFoundException(bookieId);
-        } catch (InterruptedException | KeeperException e) {
+        } catch (InterruptedException e) {
+            Thread.currentThread().interrupt();
+            throw new MetadataStoreException("Interrupted deleting cookie for 
bookie " + bookieId, e);
+        } catch (KeeperException e) {
             throw new MetadataStoreException("Failed to delete cookie for 
bookie " + bookieId);
         }
 
@@ -625,6 +640,7 @@ public class ZKRegistrationManager implements 
RegistrationManager {
             log.error("ZK exception while checking registration ephemeral 
znodes for BookieId: {}", bookieId, e);
             throw new MetadataStoreException(e);
         } catch (InterruptedException e) {
+            Thread.currentThread().interrupt();
             log.error("InterruptedException while checking registration 
ephemeral znodes for BookieId: {}", bookieId,
                     e);
             throw new MetadataStoreException(e);
diff --git 
a/bookkeeper-server/src/main/java/org/apache/bookkeeper/meta/LegacyHierarchicalLedgerManager.java
 
b/bookkeeper-server/src/main/java/org/apache/bookkeeper/meta/LegacyHierarchicalLedgerManager.java
index 59c3f2c..76ecc9d 100644
--- 
a/bookkeeper-server/src/main/java/org/apache/bookkeeper/meta/LegacyHierarchicalLedgerManager.java
+++ 
b/bookkeeper-server/src/main/java/org/apache/bookkeeper/meta/LegacyHierarchicalLedgerManager.java
@@ -267,6 +267,7 @@ class LegacyHierarchicalLedgerManager extends 
AbstractHierarchicalLedgerManager
                  * return an empty list. */
                 ledgerNodes = new ArrayList<>();
             } catch (InterruptedException e) {
+                Thread.currentThread().interrupt();
                 throw new IOException("Error when get child nodes from zk", e);
             }
             NavigableSet<Long> zkActiveLedgers = ledgerListToSet(ledgerNodes, 
nodePath);
diff --git 
a/bookkeeper-server/src/main/java/org/apache/bookkeeper/meta/LongZkLedgerIdGenerator.java
 
b/bookkeeper-server/src/main/java/org/apache/bookkeeper/meta/LongZkLedgerIdGenerator.java
index c2cb071..d959c33 100644
--- 
a/bookkeeper-server/src/main/java/org/apache/bookkeeper/meta/LongZkLedgerIdGenerator.java
+++ 
b/bookkeeper-server/src/main/java/org/apache/bookkeeper/meta/LongZkLedgerIdGenerator.java
@@ -103,6 +103,7 @@ public class LongZkLedgerIdGenerator implements 
LedgerIdGenerator {
                         LOG.error("Failed to create long ledger ID path", e);
                         cb.operationComplete(BKException.Code.ZKException, 
null);
                     } catch (InterruptedException e) {
+                        Thread.currentThread().interrupt();
                         LOG.error("Failed to create long ledger ID path", e);
                         
cb.operationComplete(BKException.Code.InterruptedException, null);
                     } catch (IOException e) {
@@ -241,6 +242,7 @@ public class LongZkLedgerIdGenerator implements 
LedgerIdGenerator {
                             
setLedgerIdGenPathStatus(HighOrderLedgerIdGenPathStatus.UNKNOWN);
                             cb.operationComplete(BKException.Code.ZKException, 
null);
                         } catch (InterruptedException e) {
+                            Thread.currentThread().interrupt();
                             LOG.error("Failed to create long ledger ID path", 
e);
                             
setLedgerIdGenPathStatus(HighOrderLedgerIdGenPathStatus.UNKNOWN);
                             
cb.operationComplete(BKException.Code.InterruptedException, null);
@@ -318,6 +320,7 @@ public class LongZkLedgerIdGenerator implements 
LedgerIdGenerator {
             LOG.error("Failed to create long ledger ID path", e);
             cb.operationComplete(BKException.Code.ZKException, null);
         } catch (InterruptedException e) {
+            Thread.currentThread().interrupt();
             LOG.error("Failed to create long ledger ID path", e);
             cb.operationComplete(BKException.Code.InterruptedException, null);
         } catch (IOException e) {
diff --git 
a/bookkeeper-server/src/main/java/org/apache/bookkeeper/meta/MSLedgerManagerFactory.java
 
b/bookkeeper-server/src/main/java/org/apache/bookkeeper/meta/MSLedgerManagerFactory.java
index 1d189c9..a175cc4 100644
--- 
a/bookkeeper-server/src/main/java/org/apache/bookkeeper/meta/MSLedgerManagerFactory.java
+++ 
b/bookkeeper-server/src/main/java/org/apache/bookkeeper/meta/MSLedgerManagerFactory.java
@@ -181,6 +181,7 @@ public class MSLedgerManagerFactory extends 
AbstractZkLedgerManagerFactory {
                     wait();
                 }
             } catch (InterruptedException ie) {
+                Thread.currentThread().interrupt();
             }
         }
 
diff --git 
a/bookkeeper-server/src/main/java/org/apache/bookkeeper/proto/BookieNettyServer.java
 
b/bookkeeper-server/src/main/java/org/apache/bookkeeper/proto/BookieNettyServer.java
index 83a3777..bc303b9 100644
--- 
a/bookkeeper-server/src/main/java/org/apache/bookkeeper/proto/BookieNettyServer.java
+++ 
b/bookkeeper-server/src/main/java/org/apache/bookkeeper/proto/BookieNettyServer.java
@@ -169,6 +169,7 @@ class BookieNettyServer {
                         try {
                             Thread.sleep(10);
                         } catch (InterruptedException e) {
+                            Thread.currentThread().interrupt();
                         }
                     }
                 });
@@ -406,6 +407,7 @@ class BookieNettyServer {
             try {
                 eventLoopGroup.shutdownGracefully(0, 10, 
TimeUnit.MILLISECONDS).await();
             } catch (InterruptedException e) {
+                Thread.currentThread().interrupt();
                 /// OK
             }
         }
diff --git 
a/bookkeeper-server/src/main/java/org/apache/bookkeeper/proto/BookieServer.java 
b/bookkeeper-server/src/main/java/org/apache/bookkeeper/proto/BookieServer.java
index 602134a..a120202 100644
--- 
a/bookkeeper-server/src/main/java/org/apache/bookkeeper/proto/BookieServer.java
+++ 
b/bookkeeper-server/src/main/java/org/apache/bookkeeper/proto/BookieServer.java
@@ -225,6 +225,7 @@ public class BookieServer {
                     Thread.sleep(watchInterval);
                 } catch (InterruptedException ie) {
                     // do nothing
+                    Thread.currentThread().interrupt();
                 }
                 if (!isBookieRunning()) {
                     shutdown();
diff --git 
a/bookkeeper-server/src/main/java/org/apache/bookkeeper/proto/ReadEntryProcessor.java
 
b/bookkeeper-server/src/main/java/org/apache/bookkeeper/proto/ReadEntryProcessor.java
index b450a5a..ee1e930 100644
--- 
a/bookkeeper-server/src/main/java/org/apache/bookkeeper/proto/ReadEntryProcessor.java
+++ 
b/bookkeeper-server/src/main/java/org/apache/bookkeeper/proto/ReadEntryProcessor.java
@@ -93,6 +93,7 @@ class ReadEntryProcessor extends PacketProcessorBase {
                         errorCode = BookieProtocol.EOK;
                     }
                 } catch (InterruptedException ie) {
+                    Thread.currentThread().interrupt();
                     LOG.error("Interrupting fence read entry {}", read, ie);
                     errorCode = BookieProtocol.EIO;
                     data.release();
diff --git 
a/bookkeeper-server/src/main/java/org/apache/bookkeeper/replication/Auditor.java
 
b/bookkeeper-server/src/main/java/org/apache/bookkeeper/replication/Auditor.java
index b9cb2da..75b29ba 100644
--- 
a/bookkeeper-server/src/main/java/org/apache/bookkeeper/replication/Auditor.java
+++ 
b/bookkeeper-server/src/main/java/org/apache/bookkeeper/replication/Auditor.java
@@ -164,6 +164,7 @@ public class Auditor {
             throw new UnavailableException(
                     "Exception while initializing Auditor", ioe);
         } catch (InterruptedException ie) {
+            Thread.currentThread().interrupt();
             throw new UnavailableException(
                     "Interrupted while initializing Auditor", ie);
         }
diff --git 
a/bookkeeper-server/src/main/java/org/apache/bookkeeper/replication/AuditorElector.java
 
b/bookkeeper-server/src/main/java/org/apache/bookkeeper/replication/AuditorElector.java
index aca74c5..8fbd159 100644
--- 
a/bookkeeper-server/src/main/java/org/apache/bookkeeper/replication/AuditorElector.java
+++ 
b/bookkeeper-server/src/main/java/org/apache/bookkeeper/replication/AuditorElector.java
@@ -224,6 +224,7 @@ public class AuditorElector {
                         try {
                             zkc.delete(myVote, -1);
                         } catch (InterruptedException ie) {
+                            Thread.currentThread().interrupt();
                             LOG.warn("InterruptedException while deleting 
myVote: " + myVote,
                                      ie);
                         } catch (KeeperException ke) {
diff --git 
a/bookkeeper-server/src/main/java/org/apache/bookkeeper/replication/AutoRecoveryMain.java
 
b/bookkeeper-server/src/main/java/org/apache/bookkeeper/replication/AutoRecoveryMain.java
index d25e4d3..bc9fed1 100644
--- 
a/bookkeeper-server/src/main/java/org/apache/bookkeeper/replication/AutoRecoveryMain.java
+++ 
b/bookkeeper-server/src/main/java/org/apache/bookkeeper/replication/AutoRecoveryMain.java
@@ -208,6 +208,7 @@ public class AutoRecoveryMain {
                 try {
                     Thread.sleep(watchInterval);
                 } catch (InterruptedException ie) {
+                    Thread.currentThread().interrupt();
                     break;
                 }
                 // If any one service not running, then shutdown peer.
diff --git 
a/bookkeeper-server/src/main/java/org/apache/bookkeeper/replication/ReplicationWorker.java
 
b/bookkeeper-server/src/main/java/org/apache/bookkeeper/replication/ReplicationWorker.java
index 8318b2f..8969aa6 100644
--- 
a/bookkeeper-server/src/main/java/org/apache/bookkeeper/replication/ReplicationWorker.java
+++ 
b/bookkeeper-server/src/main/java/org/apache/bookkeeper/replication/ReplicationWorker.java
@@ -188,6 +188,7 @@ public class ReplicationWorker implements Runnable {
         try {
             Thread.sleep(backoffMs);
         } catch (InterruptedException e) {
+            Thread.currentThread().interrupt();
         }
     }
 
diff --git 
a/bookkeeper-server/src/main/java/org/apache/bookkeeper/sasl/SASLBookieAuthProviderFactory.java
 
b/bookkeeper-server/src/main/java/org/apache/bookkeeper/sasl/SASLBookieAuthProviderFactory.java
index a5fe1d8..2506286 100644
--- 
a/bookkeeper-server/src/main/java/org/apache/bookkeeper/sasl/SASLBookieAuthProviderFactory.java
+++ 
b/bookkeeper-server/src/main/java/org/apache/bookkeeper/sasl/SASLBookieAuthProviderFactory.java
@@ -114,6 +114,7 @@ public class SASLBookieAuthProviderFactory implements 
org.apache.bookkeeper.auth
             try {
                 ticketRefreshThread.join(10000);
             } catch (InterruptedException exit) {
+                Thread.currentThread().interrupt();
                 if (LOG.isDebugEnabled()) {
                     LOG.debug("interrupted while waiting for TGT reresh thread 
to stop", exit);
                 }
diff --git 
a/bookkeeper-server/src/main/java/org/apache/bookkeeper/sasl/SASLClientProviderFactory.java
 
b/bookkeeper-server/src/main/java/org/apache/bookkeeper/sasl/SASLClientProviderFactory.java
index 180a9d1..7fd9b7d 100644
--- 
a/bookkeeper-server/src/main/java/org/apache/bookkeeper/sasl/SASLClientProviderFactory.java
+++ 
b/bookkeeper-server/src/main/java/org/apache/bookkeeper/sasl/SASLClientProviderFactory.java
@@ -122,6 +122,7 @@ public class SASLClientProviderFactory implements
             try {
                 ticketRefreshThread.join(10000);
             } catch (InterruptedException exit) {
+                Thread.currentThread().interrupt();
                 if (LOG.isDebugEnabled()) {
                     LOG.debug("interrupted while waiting for TGT reresh thread 
to stop", exit);
                 }
diff --git 
a/bookkeeper-server/src/main/java/org/apache/bookkeeper/sasl/TGTRefreshThread.java
 
b/bookkeeper-server/src/main/java/org/apache/bookkeeper/sasl/TGTRefreshThread.java
index 480b9e8..f4a2508 100644
--- 
a/bookkeeper-server/src/main/java/org/apache/bookkeeper/sasl/TGTRefreshThread.java
+++ 
b/bookkeeper-server/src/main/java/org/apache/bookkeeper/sasl/TGTRefreshThread.java
@@ -166,6 +166,7 @@ class TGTRefreshThread extends Thread {
                 try {
                     Thread.sleep(nextRefresh - now);
                 } catch (InterruptedException ie) {
+                    Thread.currentThread().interrupt();
                     LOG.warn("TGT renewal thread has been interrupted and will 
exit.");
                     break;
                 }
@@ -195,6 +196,7 @@ class TGTRefreshThread extends Thread {
                             try {
                                 Thread.sleep(10 * 1000);
                             } catch (InterruptedException ie) {
+                                Thread.currentThread().interrupt();
                                 LOG.error("Interrupted while renewing TGT, 
exiting Login thread");
                                 return;
                             }
@@ -220,6 +222,7 @@ class TGTRefreshThread extends Thread {
                             try {
                                 Thread.sleep(10 * 1000);
                             } catch (InterruptedException e) {
+                                Thread.currentThread().interrupt();
                                 LOG.error("Interrupted during login retry 
after LoginException:", le);
                                 throw le;
                             }
diff --git 
a/bookkeeper-server/src/main/java/org/apache/bookkeeper/server/Main.java 
b/bookkeeper-server/src/main/java/org/apache/bookkeeper/server/Main.java
index 2fa40fa..58d8431 100644
--- a/bookkeeper-server/src/main/java/org/apache/bookkeeper/server/Main.java
+++ b/bookkeeper-server/src/main/java/org/apache/bookkeeper/server/Main.java
@@ -214,6 +214,7 @@ public class Main {
         try {
             ComponentStarter.startComponent(server).get();
         } catch (InterruptedException ie) {
+            Thread.currentThread().interrupt();
             // the server is interrupted
             log.info("Bookie server is interrupted. Exiting ...");
         } catch (ExecutionException ee) {
diff --git 
a/bookkeeper-server/src/main/java/org/apache/bookkeeper/server/http/BKHttpServiceProvider.java
 
b/bookkeeper-server/src/main/java/org/apache/bookkeeper/server/http/BKHttpServiceProvider.java
index c6b85d2..fb15a5f 100644
--- 
a/bookkeeper-server/src/main/java/org/apache/bookkeeper/server/http/BKHttpServiceProvider.java
+++ 
b/bookkeeper-server/src/main/java/org/apache/bookkeeper/server/http/BKHttpServiceProvider.java
@@ -105,9 +105,13 @@ public class BKHttpServiceProvider implements 
HttpServiceProvider {
             if (zk != null) {
                 zk.close();
             }
-        } catch (InterruptedException | BKException e) {
-            log.error("Error while close BKHttpServiceProvider", e);
-            throw new IOException("Error while close BKHttpServiceProvider", 
e);
+        } catch (InterruptedException ie) {
+            Thread.currentThread().interrupt();
+            log.error("Interruption while closing BKHttpServiceProvider", ie);
+            throw new IOException("Interruption while closing 
BKHttpServiceProvider", ie);
+        } catch (BKException e) {
+            log.error("Error while closing BKHttpServiceProvider", e);
+            throw new IOException("Error while closing BKHttpServiceProvider", 
e);
         }
     }
 
diff --git 
a/bookkeeper-server/src/main/java/org/apache/bookkeeper/shims/zk/ZooKeeperServerShimImpl.java
 
b/bookkeeper-server/src/main/java/org/apache/bookkeeper/shims/zk/ZooKeeperServerShimImpl.java
index cc6e2e2..df9d329 100644
--- 
a/bookkeeper-server/src/main/java/org/apache/bookkeeper/shims/zk/ZooKeeperServerShimImpl.java
+++ 
b/bookkeeper-server/src/main/java/org/apache/bookkeeper/shims/zk/ZooKeeperServerShimImpl.java
@@ -46,6 +46,7 @@ class ZooKeeperServerShimImpl implements ZooKeeperServerShim {
         try {
             serverFactory.startup(zks);
         } catch (InterruptedException e) {
+            Thread.currentThread().interrupt();
             throw new IOException("Interrupted when starting zookeeper server 
: ", e);
         }
     }
diff --git 
a/bookkeeper-server/src/main/java/org/apache/bookkeeper/util/HardLink.java 
b/bookkeeper-server/src/main/java/org/apache/bookkeeper/util/HardLink.java
index 89359c8..c8c7a71 100644
--- a/bookkeeper-server/src/main/java/org/apache/bookkeeper/util/HardLink.java
+++ b/bookkeeper-server/src/main/java/org/apache/bookkeeper/util/HardLink.java
@@ -434,6 +434,7 @@ public class HardLink {
         throw new IOException(errMsg + inpMsg);
       }
     } catch (InterruptedException e) {
+      Thread.currentThread().interrupt();
       throw new IOException(e);
     } finally {
       process.destroy();
@@ -526,6 +527,7 @@ public class HardLink {
         throw new IOException(errMsg + inpMsg);
       }
     } catch (InterruptedException e) {
+      Thread.currentThread().interrupt();
       throw new IOException(e);
     } finally {
       process.destroy();
@@ -574,6 +576,7 @@ public class HardLink {
     } catch (NumberFormatException e) {
       throw createIOException(fileName, inpMsg, errMsg, exitValue, e);
     } catch (InterruptedException e) {
+      Thread.currentThread().interrupt();
       throw createIOException(fileName, inpMsg, errMsg, exitValue, e);
     } finally {
       process.destroy();
@@ -660,6 +663,7 @@ public class HardLink {
         r = new BufferedReader(new InputStreamReader(p.getInputStream(), 
UTF_8));
         return r.readLine();
       } catch (InterruptedException ie) {
+        Thread.currentThread().interrupt();
         throw new IOException("Couldn't resolve path " + filename, ie);
       } finally {
         if (r != null) {
diff --git 
a/bookkeeper-server/src/main/java/org/apache/bookkeeper/util/LocalBookKeeper.java
 
b/bookkeeper-server/src/main/java/org/apache/bookkeeper/util/LocalBookKeeper.java
index 0d83413..b8b2351 100644
--- 
a/bookkeeper-server/src/main/java/org/apache/bookkeeper/util/LocalBookKeeper.java
+++ 
b/bookkeeper-server/src/main/java/org/apache/bookkeeper/util/LocalBookKeeper.java
@@ -137,6 +137,7 @@ public class LocalBookKeeper {
             LOG.error("Exception while creating znodes", e);
             throw new IOException("Error creating znodes : ", e);
         } catch (InterruptedException e) {
+            Thread.currentThread().interrupt();
             LOG.error("Interrupted while creating znodes", e);
             throw new IOException("Error creating znodes : ", e);
         }
@@ -162,6 +163,7 @@ public class LocalBookKeeper {
             cleanupDirectories(tempDirs);
             throw ke;
         } catch (InterruptedException ie) {
+            Thread.currentThread().interrupt();
             cleanupDirectories(tempDirs);
             throw ie;
         } catch (BookieException be) {
@@ -360,6 +362,7 @@ public class LocalBookKeeper {
                     Thread.sleep(5000);
                 }
             } catch (InterruptedException ie) {
+                Thread.currentThread().interrupt();
                 if (stopOnExit) {
                     lb.shutdownBookies();
 
@@ -506,6 +509,7 @@ public class LocalBookKeeper {
             try {
                 Thread.sleep(250);
             } catch (InterruptedException e) {
+                Thread.currentThread().interrupt();
                 // ignore
             }
         }
diff --git 
a/bookkeeper-server/src/main/java/org/apache/bookkeeper/util/Shell.java 
b/bookkeeper-server/src/main/java/org/apache/bookkeeper/util/Shell.java
index a5c4ea1..9e37614 100644
--- a/bookkeeper-server/src/main/java/org/apache/bookkeeper/util/Shell.java
+++ b/bookkeeper-server/src/main/java/org/apache/bookkeeper/util/Shell.java
@@ -168,6 +168,7 @@ public abstract class Shell {
                 // make sure that the error thread exits
                 errThread.join();
             } catch (InterruptedException ie) {
+                Thread.currentThread().interrupt();
                 LOG.warn("Interrupted while reading the error stream", ie);
             }
             completed.set(true);
@@ -177,6 +178,7 @@ public abstract class Shell {
                 throw new ExitCodeException(exitCode, errMsg.toString());
             }
         } catch (InterruptedException ie) {
+            Thread.currentThread().interrupt();
             throw new IOException(ie.toString());
         } finally {
             if (timeOutTimer != null) {
diff --git 
a/bookkeeper-server/src/main/java/org/apache/bookkeeper/zookeeper/ZooKeeperClient.java
 
b/bookkeeper-server/src/main/java/org/apache/bookkeeper/zookeeper/ZooKeeperClient.java
index 0c143da..8147817 100644
--- 
a/bookkeeper-server/src/main/java/org/apache/bookkeeper/zookeeper/ZooKeeperClient.java
+++ 
b/bookkeeper-server/src/main/java/org/apache/bookkeeper/zookeeper/ZooKeeperClient.java
@@ -252,6 +252,7 @@ public class ZooKeeperClient extends ZooKeeper implements 
Watcher {
                 client.close();
                 throw ke;
             } catch (InterruptedException ie) {
+                Thread.currentThread().interrupt();
                 client.close();
                 throw ie;
             }
diff --git 
a/bookkeeper-server/src/test/java/org/apache/bookkeeper/bookie/BookieShutdownTest.java
 
b/bookkeeper-server/src/test/java/org/apache/bookkeeper/bookie/BookieShutdownTest.java
index 2ea6544..3fbb5c8 100644
--- 
a/bookkeeper-server/src/test/java/org/apache/bookkeeper/bookie/BookieShutdownTest.java
+++ 
b/bookkeeper-server/src/test/java/org/apache/bookkeeper/bookie/BookieShutdownTest.java
@@ -93,6 +93,7 @@ public class BookieShutdownTest extends 
BookKeeperClusterTestCase {
                 LOG.error("Caught BKException", e);
                 fail(e.toString());
             } catch (InterruptedException e) {
+                Thread.currentThread().interrupt();
                 LOG.error("Caught InterruptedException", e);
                 fail(e.toString());
             }
@@ -127,6 +128,7 @@ public class BookieShutdownTest extends 
BookKeeperClusterTestCase {
                 try {
                     latch.await();
                 } catch (InterruptedException e) {
+                    Thread.currentThread().interrupt();
                     // Ignore
                 }
                 triggerBookieShutdown(ExitCode.BOOKIE_EXCEPTION);
diff --git 
a/bookkeeper-server/src/test/java/org/apache/bookkeeper/bookie/SortedLedgerStorageCheckpointTest.java
 
b/bookkeeper-server/src/test/java/org/apache/bookkeeper/bookie/SortedLedgerStorageCheckpointTest.java
index 2dfebdf..cf2a49f 100644
--- 
a/bookkeeper-server/src/test/java/org/apache/bookkeeper/bookie/SortedLedgerStorageCheckpointTest.java
+++ 
b/bookkeeper-server/src/test/java/org/apache/bookkeeper/bookie/SortedLedgerStorageCheckpointTest.java
@@ -203,6 +203,7 @@ public class SortedLedgerStorageCheckpointTest extends 
LedgerStorageTestBase {
             try {
                 readyLatch.await();
             } catch (InterruptedException e) {
+                Thread.currentThread().interrupt();
             }
         });
 
diff --git 
a/bookkeeper-server/src/test/java/org/apache/bookkeeper/bookie/storage/ldb/DbLedgerStorageWriteCacheTest.java
 
b/bookkeeper-server/src/test/java/org/apache/bookkeeper/bookie/storage/ldb/DbLedgerStorageWriteCacheTest.java
index c2281a7..df81082 100644
--- 
a/bookkeeper-server/src/test/java/org/apache/bookkeeper/bookie/storage/ldb/DbLedgerStorageWriteCacheTest.java
+++ 
b/bookkeeper-server/src/test/java/org/apache/bookkeeper/bookie/storage/ldb/DbLedgerStorageWriteCacheTest.java
@@ -62,6 +62,7 @@ public class DbLedgerStorageWriteCacheTest {
                 try {
                     Thread.sleep(1000);
                 } catch (InterruptedException e) {
+                    Thread.currentThread().interrupt();
                     return;
                 }
             } finally {
diff --git 
a/bookkeeper-server/src/test/java/org/apache/bookkeeper/bookie/storage/ldb/WriteCacheTest.java
 
b/bookkeeper-server/src/test/java/org/apache/bookkeeper/bookie/storage/ldb/WriteCacheTest.java
index f5b0599..75feb32 100644
--- 
a/bookkeeper-server/src/test/java/org/apache/bookkeeper/bookie/storage/ldb/WriteCacheTest.java
+++ 
b/bookkeeper-server/src/test/java/org/apache/bookkeeper/bookie/storage/ldb/WriteCacheTest.java
@@ -175,7 +175,10 @@ public class WriteCacheTest {
             executor.submit(() -> {
                 try {
                     barrier.await();
-                } catch (InterruptedException | BrokenBarrierException e) {
+                } catch (InterruptedException ie) {
+                    Thread.currentThread().interrupt();
+                    throw new RuntimeException(ie);
+                } catch (BrokenBarrierException e) {
                     throw new RuntimeException(e);
                 }
 
diff --git 
a/bookkeeper-server/src/test/java/org/apache/bookkeeper/client/BookKeeperClientTestsWithBookieErrors.java
 
b/bookkeeper-server/src/test/java/org/apache/bookkeeper/client/BookKeeperClientTestsWithBookieErrors.java
index 98f1961..39ff902 100644
--- 
a/bookkeeper-server/src/test/java/org/apache/bookkeeper/client/BookKeeperClientTestsWithBookieErrors.java
+++ 
b/bookkeeper-server/src/test/java/org/apache/bookkeeper/client/BookKeeperClientTestsWithBookieErrors.java
@@ -88,6 +88,7 @@ public class BookKeeperClientTestsWithBookieErrors extends 
BookKeeperClusterTest
             try {
                 Thread.sleep(sleepTime);
             } catch (InterruptedException e) {
+                Thread.currentThread().interrupt();
             }
         };
     }
diff --git 
a/bookkeeper-server/src/test/java/org/apache/bookkeeper/client/BookKeeperClientZKSessionExpiry.java
 
b/bookkeeper-server/src/test/java/org/apache/bookkeeper/client/BookKeeperClientZKSessionExpiry.java
index bdcfd25..b1a8bb6 100644
--- 
a/bookkeeper-server/src/test/java/org/apache/bookkeeper/client/BookKeeperClientZKSessionExpiry.java
+++ 
b/bookkeeper-server/src/test/java/org/apache/bookkeeper/client/BookKeeperClientZKSessionExpiry.java
@@ -60,6 +60,7 @@ public class BookKeeperClientZKSessionExpiry extends 
BookKeeperClusterTestCase {
                             }
                         }
                     } catch (InterruptedException ie) {
+                        Thread.currentThread().interrupt();
                         return;
                     }
                 }
diff --git 
a/bookkeeper-server/src/test/java/org/apache/bookkeeper/client/LedgerCloseTest.java
 
b/bookkeeper-server/src/test/java/org/apache/bookkeeper/client/LedgerCloseTest.java
index 900a7c2..6bb2a2a 100644
--- 
a/bookkeeper-server/src/test/java/org/apache/bookkeeper/client/LedgerCloseTest.java
+++ 
b/bookkeeper-server/src/test/java/org/apache/bookkeeper/client/LedgerCloseTest.java
@@ -168,6 +168,7 @@ public class LedgerCloseTest extends 
BookKeeperClusterTestCase {
                         try {
                             recoverDoneLatch.await();
                         } catch (InterruptedException ie) {
+                            Thread.currentThread().interrupt();
                         }
                     }
                 }
@@ -202,6 +203,7 @@ public class LedgerCloseTest extends 
BookKeeperClusterTestCase {
                 try {
                     latch.await();
                 } catch (InterruptedException e) {
+                    Thread.currentThread().interrupt();
                 }
                 throw 
BookieException.create(BookieException.Code.UnauthorizedAccessException);
             }
@@ -226,6 +228,7 @@ public class LedgerCloseTest extends 
BookKeeperClusterTestCase {
                 try {
                     latch.await();
                 } catch (InterruptedException e) {
+                    Thread.currentThread().interrupt();
                 }
                 // simulate slow adds.
                 throw new IOException("Dead bookie");
diff --git 
a/bookkeeper-server/src/test/java/org/apache/bookkeeper/client/ParallelLedgerRecoveryTest.java
 
b/bookkeeper-server/src/test/java/org/apache/bookkeeper/client/ParallelLedgerRecoveryTest.java
index 8c49531..2389929 100644
--- 
a/bookkeeper-server/src/test/java/org/apache/bookkeeper/client/ParallelLedgerRecoveryTest.java
+++ 
b/bookkeeper-server/src/test/java/org/apache/bookkeeper/client/ParallelLedgerRecoveryTest.java
@@ -115,6 +115,7 @@ public class ParallelLedgerRecoveryTest extends 
BookKeeperClusterTestCase {
                         try {
                             cdl.await();
                         } catch (InterruptedException e) {
+                            Thread.currentThread().interrupt();
                             LOG.error("Interrupted on waiting latch : ", e);
                         }
                         lm.writeLedgerMetadata(ledgerId, metadata, cb);
@@ -480,6 +481,7 @@ public class ParallelLedgerRecoveryTest extends 
BookKeeperClusterTestCase {
                     try {
                         latch.await();
                     } catch (InterruptedException e) {
+                        Thread.currentThread().interrupt();
                         // no-op
                     }
                 }
diff --git 
a/bookkeeper-server/src/test/java/org/apache/bookkeeper/client/TestReadLastConfirmedAndEntry.java
 
b/bookkeeper-server/src/test/java/org/apache/bookkeeper/client/TestReadLastConfirmedAndEntry.java
index 79a197e..d78b228 100644
--- 
a/bookkeeper-server/src/test/java/org/apache/bookkeeper/client/TestReadLastConfirmedAndEntry.java
+++ 
b/bookkeeper-server/src/test/java/org/apache/bookkeeper/client/TestReadLastConfirmedAndEntry.java
@@ -78,6 +78,7 @@ public class TestReadLastConfirmedAndEntry extends 
BookKeeperClusterTestCase {
                     try {
                         Thread.sleep(600000);
                     } catch (InterruptedException e) {
+                        Thread.currentThread().interrupt();
                         // ignore
                     }
                 } else {
@@ -177,6 +178,7 @@ public class TestReadLastConfirmedAndEntry extends 
BookKeeperClusterTestCase {
                 try {
                     readLatch.await();
                 } catch (InterruptedException e) {
+                    Thread.currentThread().interrupt();
                     // no-op
                 }
             }
diff --git 
a/bookkeeper-server/src/test/java/org/apache/bookkeeper/meta/GcLedgersTest.java 
b/bookkeeper-server/src/test/java/org/apache/bookkeeper/meta/GcLedgersTest.java
index 4bad052..71854f9 100644
--- 
a/bookkeeper-server/src/test/java/org/apache/bookkeeper/meta/GcLedgersTest.java
+++ 
b/bookkeeper-server/src/test/java/org/apache/bookkeeper/meta/GcLedgersTest.java
@@ -130,6 +130,7 @@ public class GcLedgersTest extends LedgerManagerTestCase {
                     expected.wait(100);
                 }
             } catch (InterruptedException ie) {
+                Thread.currentThread().interrupt();
             }
         }
     }
@@ -209,6 +210,7 @@ public class GcLedgersTest extends LedgerManagerTestCase {
                             try {
                                 createLatch.await();
                             } catch (InterruptedException ie) {
+                                Thread.currentThread().interrupt();
                             }
                             paused = true;
                         }
diff --git 
a/bookkeeper-server/src/test/java/org/apache/bookkeeper/meta/LedgerManagerIteratorTest.java
 
b/bookkeeper-server/src/test/java/org/apache/bookkeeper/meta/LedgerManagerIteratorTest.java
index c82198d..9286d6f 100644
--- 
a/bookkeeper-server/src/test/java/org/apache/bookkeeper/meta/LedgerManagerIteratorTest.java
+++ 
b/bookkeeper-server/src/test/java/org/apache/bookkeeper/meta/LedgerManagerIteratorTest.java
@@ -420,6 +420,7 @@ public class LedgerManagerIteratorTest extends 
LedgerManagerTestCase {
                 try {
                     latch.await();
                 } catch (InterruptedException e) {
+                    Thread.currentThread().interrupt();
                     fail("Checker interrupted");
                 }
                 while (MathUtils.elapsedNanos(start) < runtime) {
@@ -448,6 +449,7 @@ public class LedgerManagerIteratorTest extends 
LedgerManagerTestCase {
                 try {
                     latch.await();
                 } catch (InterruptedException e) {
+                    Thread.currentThread().interrupt();
                     fail("Checker interrupted");
                     e.printStackTrace();
                 }
diff --git 
a/bookkeeper-server/src/test/java/org/apache/bookkeeper/metastore/MetastoreTableAsyncToSyncConverter.java
 
b/bookkeeper-server/src/test/java/org/apache/bookkeeper/metastore/MetastoreTableAsyncToSyncConverter.java
index 12c6a66..b1775e8 100644
--- 
a/bookkeeper-server/src/test/java/org/apache/bookkeeper/metastore/MetastoreTableAsyncToSyncConverter.java
+++ 
b/bookkeeper-server/src/test/java/org/apache/bookkeeper/metastore/MetastoreTableAsyncToSyncConverter.java
@@ -41,6 +41,7 @@ public class MetastoreTableAsyncToSyncConverter {
             try {
                 countDownLatch.await(10, TimeUnit.SECONDS);
             } catch (InterruptedException ie) {
+                Thread.currentThread().interrupt();
                 throw MSException.create(Code.InterruptedException);
             }
 
diff --git 
a/bookkeeper-server/src/test/java/org/apache/bookkeeper/proto/TestPerChannelBookieClient.java
 
b/bookkeeper-server/src/test/java/org/apache/bookkeeper/proto/TestPerChannelBookieClient.java
index 6dccf25..d08dd8a 100644
--- 
a/bookkeeper-server/src/test/java/org/apache/bookkeeper/proto/TestPerChannelBookieClient.java
+++ 
b/bookkeeper-server/src/test/java/org/apache/bookkeeper/proto/TestPerChannelBookieClient.java
@@ -240,6 +240,7 @@ public class TestPerChannelBookieClient extends 
BookKeeperClusterTestCase {
                 try {
                     Thread.sleep(3000);
                 } catch (InterruptedException ie) {
+                    Thread.currentThread().interrupt();
                     throw new IOException("Interrupted waiting", ie);
                 }
                 return super.readEntry(ledgerId, entryId);
diff --git 
a/bookkeeper-server/src/test/java/org/apache/bookkeeper/replication/BookieLedgerIndexTest.java
 
b/bookkeeper-server/src/test/java/org/apache/bookkeeper/replication/BookieLedgerIndexTest.java
index 6aef30d..843927d 100644
--- 
a/bookkeeper-server/src/test/java/org/apache/bookkeeper/replication/BookieLedgerIndexTest.java
+++ 
b/bookkeeper-server/src/test/java/org/apache/bookkeeper/replication/BookieLedgerIndexTest.java
@@ -213,6 +213,7 @@ public class BookieLedgerIndexTest extends 
BookKeeperClusterTestCase {
             LOG.error("Test failed", e);
             fail("Test failed due to BookKeeper exception");
         } catch (InterruptedException e) {
+            Thread.currentThread().interrupt();
             LOG.error("Test failed", e);
             fail("Test failed due to interruption");
         }
diff --git 
a/bookkeeper-server/src/test/java/org/apache/bookkeeper/replication/TestLedgerUnderreplicationManager.java
 
b/bookkeeper-server/src/test/java/org/apache/bookkeeper/replication/TestLedgerUnderreplicationManager.java
index 97b0d97..63da432 100644
--- 
a/bookkeeper-server/src/test/java/org/apache/bookkeeper/replication/TestLedgerUnderreplicationManager.java
+++ 
b/bookkeeper-server/src/test/java/org/apache/bookkeeper/replication/TestLedgerUnderreplicationManager.java
@@ -753,6 +753,7 @@ public class TestLedgerUnderreplicationManager {
         } catch (KeeperException e) {
             LOG.error("Exception while reading data from znode :" + znode);
         } catch (InterruptedException e) {
+            Thread.currentThread().interrupt();
             LOG.error("Exception while reading data from znode :" + znode);
         }
         return "";
diff --git 
a/bookkeeper-server/src/test/java/org/apache/bookkeeper/test/AsyncLedgerOpsTest.java
 
b/bookkeeper-server/src/test/java/org/apache/bookkeeper/test/AsyncLedgerOpsTest.java
index a2582c5..1f8717b 100644
--- 
a/bookkeeper-server/src/test/java/org/apache/bookkeeper/test/AsyncLedgerOpsTest.java
+++ 
b/bookkeeper-server/src/test/java/org/apache/bookkeeper/test/AsyncLedgerOpsTest.java
@@ -189,6 +189,7 @@ public class AsyncLedgerOpsTest extends 
BookKeeperClusterTestCase
             assertTrue("Checking number of read entries", i == 
numEntriesToWrite);
             lh.close();
         } catch (InterruptedException e) {
+            Thread.currentThread().interrupt();
             LOG.error("Interrupted", e);
             fail("InterruptedException");
         } // catch (NoSuchAlgorithmException e) {
diff --git 
a/bookkeeper-server/src/test/java/org/apache/bookkeeper/test/BookieFailureTest.java
 
b/bookkeeper-server/src/test/java/org/apache/bookkeeper/test/BookieFailureTest.java
index 2e4cf03..8a18127 100644
--- 
a/bookkeeper-server/src/test/java/org/apache/bookkeeper/test/BookieFailureTest.java
+++ 
b/bookkeeper-server/src/test/java/org/apache/bookkeeper/test/BookieFailureTest.java
@@ -236,6 +236,7 @@ public class BookieFailureTest extends 
BookKeeperClusterTestCase
             LOG.error("Caught BKException", e);
             fail(e.toString());
         } catch (InterruptedException e) {
+            Thread.currentThread().interrupt();
             LOG.error("Caught InterruptedException", e);
             fail(e.toString());
         }
diff --git 
a/bookkeeper-server/src/test/java/org/apache/bookkeeper/test/BookieReadWriteTest.java
 
b/bookkeeper-server/src/test/java/org/apache/bookkeeper/test/BookieReadWriteTest.java
index 312af39..afcb4b4 100644
--- 
a/bookkeeper-server/src/test/java/org/apache/bookkeeper/test/BookieReadWriteTest.java
+++ 
b/bookkeeper-server/src/test/java/org/apache/bookkeeper/test/BookieReadWriteTest.java
@@ -261,6 +261,7 @@ public class BookieReadWriteTest extends 
BookKeeperClusterTestCase
             LOG.error("Test failed", e);
             fail("Test failed due to BookKeeper exception");
         } catch (InterruptedException e) {
+            Thread.currentThread().interrupt();
             LOG.error("Test failed", e);
             fail("Test failed due to interruption");
         }
@@ -397,6 +398,7 @@ public class BookieReadWriteTest extends 
BookKeeperClusterTestCase
             LOG.error("Test failed", e);
             fail("Test failed due to BookKeeper exception");
         } catch (InterruptedException e) {
+            Thread.currentThread().interrupt();
             LOG.error("Test failed", e);
             fail("Test failed due to interruption");
         }
@@ -491,6 +493,7 @@ public class BookieReadWriteTest extends 
BookKeeperClusterTestCase
             LOG.error("Test failed", e);
             fail("Test failed due to BookKeeper exception");
         } catch (InterruptedException e) {
+            Thread.currentThread().interrupt();
             LOG.error("Test failed", e);
             fail("Test failed due to interruption");
         }
@@ -535,6 +538,7 @@ public class BookieReadWriteTest extends 
BookKeeperClusterTestCase
             LOG.error("Test failed", e);
             fail("Test failed due to BookKeeper exception");
         } catch (InterruptedException e) {
+            Thread.currentThread().interrupt();
             LOG.error("Test failed", e);
             fail("Test failed due to interruption");
         }
@@ -591,6 +595,7 @@ public class BookieReadWriteTest extends 
BookKeeperClusterTestCase
             LOG.error("Test failed", e);
             fail("Test failed due to BookKeeper exception");
         } catch (InterruptedException e) {
+            Thread.currentThread().interrupt();
             LOG.error("Test failed", e);
             fail("Test failed due to interruption");
         }
@@ -664,6 +669,7 @@ public class BookieReadWriteTest extends 
BookKeeperClusterTestCase
             LOG.error("Test failed", e);
             fail("Test failed due to BookKeeper exception");
         } catch (InterruptedException e) {
+            Thread.currentThread().interrupt();
             LOG.error("Test failed", e);
             fail("Test failed due to interruption");
         }
@@ -715,6 +721,7 @@ public class BookieReadWriteTest extends 
BookKeeperClusterTestCase
             LOG.error("Test failed", e);
             fail("Test failed due to BookKeeper exception");
         } catch (InterruptedException e) {
+            Thread.currentThread().interrupt();
             LOG.error("Test failed", e);
             fail("Test failed due to interruption");
         }
@@ -829,6 +836,7 @@ public class BookieReadWriteTest extends 
BookKeeperClusterTestCase
             LOG.error("Test failed", e);
             fail("Test failed due to BookKeeper exception");
         } catch (InterruptedException e) {
+            Thread.currentThread().interrupt();
             LOG.error("Test failed", e);
             fail("Test failed due to interruption");
         }
@@ -885,6 +893,7 @@ public class BookieReadWriteTest extends 
BookKeeperClusterTestCase
             LOG.error("Test failed", e);
             fail("Test failed due to BookKeeper exception");
         } catch (InterruptedException e) {
+            Thread.currentThread().interrupt();
             LOG.error("Test failed", e);
             fail("Test failed due to interruption");
         }
@@ -952,6 +961,7 @@ public class BookieReadWriteTest extends 
BookKeeperClusterTestCase
             LOG.error("Test failed", e);
             fail("Test failed due to BookKeeper exception");
         } catch (InterruptedException e) {
+            Thread.currentThread().interrupt();
             LOG.error("Test failed", e);
             fail("Test failed due to interruption");
         }
@@ -1130,6 +1140,7 @@ public class BookieReadWriteTest extends 
BookKeeperClusterTestCase
             LOG.error("Test failed", e);
             fail("Test failed due to BookKeeper exception");
         } catch (InterruptedException e) {
+            Thread.currentThread().interrupt();
             LOG.error("Test failed", e);
             fail("Test failed due to interruption");
         }
diff --git 
a/bookkeeper-server/src/test/java/org/apache/bookkeeper/test/MultipleThreadReadTest.java
 
b/bookkeeper-server/src/test/java/org/apache/bookkeeper/test/MultipleThreadReadTest.java
index 9e083da..1d3929c 100644
--- 
a/bookkeeper-server/src/test/java/org/apache/bookkeeper/test/MultipleThreadReadTest.java
+++ 
b/bookkeeper-server/src/test/java/org/apache/bookkeeper/test/MultipleThreadReadTest.java
@@ -286,6 +286,7 @@ public class MultipleThreadReadTest extends 
BookKeeperClusterTestCase {
             LOG.error("Test failed", e);
             fail("Test failed due to BookKeeper exception");
         } catch (InterruptedException e) {
+            Thread.currentThread().interrupt();
             LOG.error("Test failed", e);
             fail("Test failed due to interruption");
         }
diff --git 
a/stream/distributedlog/common/src/main/java/org/apache/distributedlog/common/util/SchedulerUtils.java
 
b/stream/distributedlog/common/src/main/java/org/apache/distributedlog/common/util/SchedulerUtils.java
index f6d4f23..e85db39 100644
--- 
a/stream/distributedlog/common/src/main/java/org/apache/distributedlog/common/util/SchedulerUtils.java
+++ 
b/stream/distributedlog/common/src/main/java/org/apache/distributedlog/common/util/SchedulerUtils.java
@@ -35,6 +35,7 @@ public class SchedulerUtils {
         try {
             service.awaitTermination(timeout, timeUnit);
         } catch (InterruptedException e) {
+            Thread.currentThread().interrupt();
             log.warn("Interrupted when shutting down scheduler : ", e);
         }
         service.shutdownNow();
diff --git 
a/stream/distributedlog/core/src/main/java/org/apache/distributedlog/BookKeeperClient.java
 
b/stream/distributedlog/core/src/main/java/org/apache/distributedlog/BookKeeperClient.java
index 33baa9d..ee16e5d 100644
--- 
a/stream/distributedlog/core/src/main/java/org/apache/distributedlog/BookKeeperClient.java
+++ 
b/stream/distributedlog/core/src/main/java/org/apache/distributedlog/BookKeeperClient.java
@@ -168,6 +168,7 @@ public class BookKeeperClient {
         try {
             commonInitialization(conf, ledgersPath, eventLoopGroup, 
statsLogger, requestTimer);
         } catch (InterruptedException e) {
+            Thread.currentThread().interrupt();
             throw new DLInterruptedException("Interrupted on creating 
bookkeeper client " + name + " : ", e);
         }
 
@@ -267,6 +268,7 @@ public class BookKeeperClient {
             try {
                 bkcToClose.close();
             } catch (InterruptedException e) {
+                Thread.currentThread().interrupt();
                 LOG.warn("Interrupted on closing bookkeeper client {} : ", 
name, e);
                 Thread.currentThread().interrupt();
             } catch (BKException e) {
diff --git 
a/stream/distributedlog/core/src/main/java/org/apache/distributedlog/LocalDLMEmulator.java
 
b/stream/distributedlog/core/src/main/java/org/apache/distributedlog/LocalDLMEmulator.java
index ff7e953..dc014f1 100644
--- 
a/stream/distributedlog/core/src/main/java/org/apache/distributedlog/LocalDLMEmulator.java
+++ 
b/stream/distributedlog/core/src/main/java/org/apache/distributedlog/LocalDLMEmulator.java
@@ -147,6 +147,7 @@ public class LocalDLMEmulator {
                             numBookies, shouldStartZK, initialBookiePort, 
serverConf);
                     LOG.info("{} bookies are started.");
                 } catch (InterruptedException e) {
+                    Thread.currentThread().interrupt();
                     // go away quietly
                 } catch (Exception e) {
                     LOG.error("Error starting local bk", e);
diff --git 
a/stream/distributedlog/core/src/main/java/org/apache/distributedlog/LogSegmentMetadata.java
 
b/stream/distributedlog/core/src/main/java/org/apache/distributedlog/LogSegmentMetadata.java
index 0e4a2f0..a9b3884 100644
--- 
a/stream/distributedlog/core/src/main/java/org/apache/distributedlog/LogSegmentMetadata.java
+++ 
b/stream/distributedlog/core/src/main/java/org/apache/distributedlog/LogSegmentMetadata.java
@@ -649,6 +649,7 @@ public class LogSegmentMetadata {
         } catch (ZooKeeperClient.ZooKeeperConnectionException e) {
             result.completeExceptionally(Utils.zkException(e, path));
         } catch (InterruptedException e) {
+            Thread.currentThread().interrupt();
             result.completeExceptionally(Utils.zkException(e, path));
         }
         return result;
@@ -1013,6 +1014,7 @@ public class LogSegmentMetadata {
         } catch (KeeperException.NodeExistsException nee) {
             throw nee;
         } catch (InterruptedException ie) {
+            Thread.currentThread().interrupt();
             throw new DLInterruptedException("Interrupted on creating ledger 
znode " + zkPath, ie);
         } catch (Exception e) {
             LOG.error("Error creating ledger znode {}", zkPath, e);
diff --git 
a/stream/distributedlog/core/src/main/java/org/apache/distributedlog/ReadAheadEntryReader.java
 
b/stream/distributedlog/core/src/main/java/org/apache/distributedlog/ReadAheadEntryReader.java
index 1d3fbce..33ff991 100644
--- 
a/stream/distributedlog/core/src/main/java/org/apache/distributedlog/ReadAheadEntryReader.java
+++ 
b/stream/distributedlog/core/src/main/java/org/apache/distributedlog/ReadAheadEntryReader.java
@@ -630,6 +630,7 @@ class ReadAheadEntryReader implements
         try {
             entry = entryQueue.poll(waitTime, waitTimeUnit);
         } catch (InterruptedException e) {
+            Thread.currentThread().interrupt();
             throw new DLInterruptedException("Interrupted on waiting next 
readahead entry : ", e);
         }
         try {
diff --git 
a/stream/distributedlog/core/src/main/java/org/apache/distributedlog/auditor/DLAuditor.java
 
b/stream/distributedlog/core/src/main/java/org/apache/distributedlog/auditor/DLAuditor.java
index 192e6e1..695f6e8 100644
--- 
a/stream/distributedlog/core/src/main/java/org/apache/distributedlog/auditor/DLAuditor.java
+++ 
b/stream/distributedlog/core/src/main/java/org/apache/distributedlog/auditor/DLAuditor.java
@@ -323,6 +323,7 @@ public class DLAuditor {
                 try {
                     collectLedgersFromPool(poolPath);
                 } catch (InterruptedException e) {
+                    Thread.currentThread().interrupt();
                     throw new DLInterruptedException("Interrupted on 
collecting"
                             + " ledgers from allocation pool " + poolPath, e);
                 } catch (KeeperException e) {
diff --git 
a/stream/distributedlog/core/src/main/java/org/apache/distributedlog/bk/LedgerAllocatorPool.java
 
b/stream/distributedlog/core/src/main/java/org/apache/distributedlog/bk/LedgerAllocatorPool.java
index b9f3a72..9f36687 100644
--- 
a/stream/distributedlog/core/src/main/java/org/apache/distributedlog/bk/LedgerAllocatorPool.java
+++ 
b/stream/distributedlog/core/src/main/java/org/apache/distributedlog/bk/LedgerAllocatorPool.java
@@ -145,6 +145,7 @@ public class LedgerAllocatorPool implements LedgerAllocator 
{
             }
             initializeAllocators(allocators);
         } catch (InterruptedException ie) {
+            Thread.currentThread().interrupt();
             throw new DLInterruptedException("Interrupted when ensuring " + 
poolPath + " created : ", ie);
         } catch (KeeperException ke) {
             throw new IOException("Encountered zookeeper exception when 
initializing pool " + poolPath + " : ", ke);
@@ -278,6 +279,7 @@ public class LedgerAllocatorPool implements LedgerAllocator 
{
                 }
             }, null);
         } catch (InterruptedException ie) {
+            Thread.currentThread().interrupt();
             logger.warn("Interrupted on rescuing ledger allocator {} : ", 
ledgerAllocator.allocatePath, ie);
             synchronized (LedgerAllocatorPool.this) {
                 rescueMap.remove(ledgerAllocator.allocatePath);
diff --git 
a/stream/distributedlog/core/src/main/java/org/apache/distributedlog/bk/SimpleLedgerAllocator.java
 
b/stream/distributedlog/core/src/main/java/org/apache/distributedlog/bk/SimpleLedgerAllocator.java
index 7a9fa58..aa0bc01 100644
--- 
a/stream/distributedlog/core/src/main/java/org/apache/distributedlog/bk/SimpleLedgerAllocator.java
+++ 
b/stream/distributedlog/core/src/main/java/org/apache/distributedlog/bk/SimpleLedgerAllocator.java
@@ -150,6 +150,7 @@ public class SimpleLedgerAllocator implements 
LedgerAllocator, FutureEventListen
         } catch (ZooKeeperClient.ZooKeeperConnectionException e) {
             return FutureUtils.exception(Utils.zkException(e, allocatePath));
         } catch (InterruptedException e) {
+            Thread.currentThread().interrupt();
             return FutureUtils.exception(Utils.zkException(e, allocatePath));
         }
     }
diff --git 
a/stream/distributedlog/core/src/main/java/org/apache/distributedlog/impl/BKNamespaceDriver.java
 
b/stream/distributedlog/core/src/main/java/org/apache/distributedlog/impl/BKNamespaceDriver.java
index 293ac2a..17f3e7b 100644
--- 
a/stream/distributedlog/core/src/main/java/org/apache/distributedlog/impl/BKNamespaceDriver.java
+++ 
b/stream/distributedlog/core/src/main/java/org/apache/distributedlog/impl/BKNamespaceDriver.java
@@ -559,6 +559,7 @@ public class BKNamespaceDriver implements NamespaceDriver {
                 }
             }
         } catch (InterruptedException ie) {
+            Thread.currentThread().interrupt();
             LOG.error("Interrupted while deleting " + namespaceRootPath, ie);
             throw new IOException("Interrupted while reading " + 
namespaceRootPath, ie);
         } catch (KeeperException ke) {
diff --git 
a/stream/distributedlog/core/src/main/java/org/apache/distributedlog/impl/ZKLogMetadataStore.java
 
b/stream/distributedlog/core/src/main/java/org/apache/distributedlog/impl/ZKLogMetadataStore.java
index 32e7ab7..fbbf2ab 100644
--- 
a/stream/distributedlog/core/src/main/java/org/apache/distributedlog/impl/ZKLogMetadataStore.java
+++ 
b/stream/distributedlog/core/src/main/java/org/apache/distributedlog/impl/ZKLogMetadataStore.java
@@ -119,6 +119,7 @@ public class ZKLogMetadataStore implements LogMetadataStore 
{
         } catch (ZooKeeperClient.ZooKeeperConnectionException e) {
             promise.completeExceptionally(e);
         } catch (InterruptedException e) {
+            Thread.currentThread().interrupt();
             promise.completeExceptionally(e);
         }
         return promise;
diff --git 
a/stream/distributedlog/core/src/main/java/org/apache/distributedlog/impl/ZKLogSegmentMetadataStore.java
 
b/stream/distributedlog/core/src/main/java/org/apache/distributedlog/impl/ZKLogSegmentMetadataStore.java
index b57a027..1b5e5d5 100644
--- 
a/stream/distributedlog/core/src/main/java/org/apache/distributedlog/impl/ZKLogSegmentMetadataStore.java
+++ 
b/stream/distributedlog/core/src/main/java/org/apache/distributedlog/impl/ZKLogSegmentMetadataStore.java
@@ -360,6 +360,7 @@ public class ZKLogSegmentMetadataStore implements 
LogSegmentMetadataStore, Watch
         } catch (ZooKeeperClient.ZooKeeperConnectionException e) {
             result.completeExceptionally(Utils.zkException(e, 
logSegmentsPath));
         } catch (InterruptedException e) {
+            Thread.currentThread().interrupt();
             result.completeExceptionally(Utils.zkException(e, 
logSegmentsPath));
         }
         return result;
diff --git 
a/stream/distributedlog/core/src/main/java/org/apache/distributedlog/impl/ZKMetadataAccessor.java
 
b/stream/distributedlog/core/src/main/java/org/apache/distributedlog/impl/ZKMetadataAccessor.java
index 481d398..37a9eca 100644
--- 
a/stream/distributedlog/core/src/main/java/org/apache/distributedlog/impl/ZKMetadataAccessor.java
+++ 
b/stream/distributedlog/core/src/main/java/org/apache/distributedlog/impl/ZKMetadataAccessor.java
@@ -171,6 +171,7 @@ public class ZKMetadataAccessor implements 
org.apache.distributedlog.api.Metadat
                 writerZKC.get().setData(zkPath, metadata, 
currentStat.getVersion());
             }
         } catch (InterruptedException ie) {
+            Thread.currentThread().interrupt();
             throw new DLInterruptedException("Interrupted on creating or 
updating container metadata", ie);
         } catch (Exception exc) {
             throw new IOException("Exception creating or updating container 
metadata", exc);
@@ -206,6 +207,7 @@ public class ZKMetadataAccessor implements 
org.apache.distributedlog.api.Metadat
                 return readerZKC.get().getData(zkPath, false, currentStat);
             }
         } catch (InterruptedException ie) {
+            Thread.currentThread().interrupt();
             throw new DLInterruptedException("Error reading the max tx id from 
zk", ie);
         } catch (Exception e) {
             throw new IOException("Error reading the max tx id from zk", e);
diff --git 
a/stream/distributedlog/core/src/main/java/org/apache/distributedlog/impl/ZKNamespaceWatcher.java
 
b/stream/distributedlog/core/src/main/java/org/apache/distributedlog/impl/ZKNamespaceWatcher.java
index f14c5bd..6bd9745 100644
--- 
a/stream/distributedlog/core/src/main/java/org/apache/distributedlog/impl/ZKNamespaceWatcher.java
+++ 
b/stream/distributedlog/core/src/main/java/org/apache/distributedlog/impl/ZKNamespaceWatcher.java
@@ -94,6 +94,7 @@ public class ZKNamespaceWatcher extends NamespaceWatcher
         } catch (ZooKeeperClient.ZooKeeperConnectionException e) {
             scheduleTask(this, conf.getZKSessionTimeoutMilliseconds());
         } catch (InterruptedException e) {
+            Thread.currentThread().interrupt();
             logger.warn("Interrupted on watching namespace changes for {} : ", 
uri, e);
             scheduleTask(this, conf.getZKSessionTimeoutMilliseconds());
         }
diff --git 
a/stream/distributedlog/core/src/main/java/org/apache/distributedlog/impl/acl/ZKAccessControl.java
 
b/stream/distributedlog/core/src/main/java/org/apache/distributedlog/impl/acl/ZKAccessControl.java
index ffc6e57..22efb7e 100644
--- 
a/stream/distributedlog/core/src/main/java/org/apache/distributedlog/impl/acl/ZKAccessControl.java
+++ 
b/stream/distributedlog/core/src/main/java/org/apache/distributedlog/impl/acl/ZKAccessControl.java
@@ -122,6 +122,7 @@ public class ZKAccessControl {
         } catch (ZooKeeperClient.ZooKeeperConnectionException e) {
             promise.completeExceptionally(e);
         } catch (InterruptedException e) {
+            Thread.currentThread().interrupt();
             promise.completeExceptionally(e);
         } catch (IOException e) {
             promise.completeExceptionally(e);
@@ -146,6 +147,7 @@ public class ZKAccessControl {
         } catch (ZooKeeperClient.ZooKeeperConnectionException e) {
             promise.completeExceptionally(e);
         } catch (InterruptedException e) {
+            Thread.currentThread().interrupt();
             promise.completeExceptionally(e);
         } catch (IOException e) {
             promise.completeExceptionally(e);
@@ -176,6 +178,7 @@ public class ZKAccessControl {
         } catch (ZooKeeperClient.ZooKeeperConnectionException e) {
             promise.completeExceptionally(e);
         } catch (InterruptedException e) {
+            Thread.currentThread().interrupt();
             promise.completeExceptionally(e);
         }
         return promise;
@@ -199,6 +202,7 @@ public class ZKAccessControl {
         } catch (ZooKeeperClient.ZooKeeperConnectionException e) {
             promise.completeExceptionally(e);
         } catch (InterruptedException e) {
+            Thread.currentThread().interrupt();
             promise.completeExceptionally(e);
         }
         return promise;
diff --git 
a/stream/distributedlog/core/src/main/java/org/apache/distributedlog/impl/acl/ZKAccessControlManager.java
 
b/stream/distributedlog/core/src/main/java/org/apache/distributedlog/impl/acl/ZKAccessControlManager.java
index 83e355f..925b14d 100644
--- 
a/stream/distributedlog/core/src/main/java/org/apache/distributedlog/impl/acl/ZKAccessControlManager.java
+++ 
b/stream/distributedlog/core/src/main/java/org/apache/distributedlog/impl/acl/ZKAccessControlManager.java
@@ -218,6 +218,7 @@ public class ZKAccessControlManager implements 
AccessControlManager, Watcher {
         } catch (ZooKeeperClient.ZooKeeperConnectionException e) {
             promise.completeExceptionally(e);
         } catch (InterruptedException e) {
+            Thread.currentThread().interrupt();
             promise.completeExceptionally(e);
         }
     }
@@ -260,6 +261,7 @@ public class ZKAccessControlManager implements 
AccessControlManager, Watcher {
             promise.completeExceptionally(e);
             return;
         } catch (InterruptedException e) {
+            Thread.currentThread().interrupt();
             promise.completeExceptionally(e);
             return;
         }
diff --git 
a/stream/distributedlog/core/src/main/java/org/apache/distributedlog/impl/federated/FederatedZKLogMetadataStore.java
 
b/stream/distributedlog/core/src/main/java/org/apache/distributedlog/impl/federated/FederatedZKLogMetadataStore.java
index 84f5ac7..ef55f4d 100644
--- 
a/stream/distributedlog/core/src/main/java/org/apache/distributedlog/impl/federated/FederatedZKLogMetadataStore.java
+++ 
b/stream/distributedlog/core/src/main/java/org/apache/distributedlog/impl/federated/FederatedZKLogMetadataStore.java
@@ -306,6 +306,7 @@ public class FederatedZKLogMetadataStore
         } catch (ZooKeeperClient.ZooKeeperConnectionException e) {
             promise.completeExceptionally(e);
         } catch (InterruptedException e) {
+            Thread.currentThread().interrupt();
             promise.completeExceptionally(e);
         }
         return promise;
@@ -343,6 +344,7 @@ public class FederatedZKLogMetadataStore
         } catch (ZooKeeperClient.ZooKeeperConnectionException e) {
             promise.completeExceptionally(e);
         } catch (InterruptedException e) {
+            Thread.currentThread().interrupt();
             promise.completeExceptionally(e);
         }
     }
@@ -540,6 +542,7 @@ public class FederatedZKLogMetadataStore
         } catch (ZooKeeperClient.ZooKeeperConnectionException e) {
             promise.completeExceptionally(e);
         } catch (InterruptedException e) {
+            Thread.currentThread().interrupt();
             promise.completeExceptionally(e);
         }
 
@@ -568,6 +571,7 @@ public class FederatedZKLogMetadataStore
                     createLogInNamespaceSync(uri, logName);
                     createPromise.complete(uri);
                 } catch (InterruptedException e) {
+                    Thread.currentThread().interrupt();
                     createPromise.completeExceptionally(e);
                 } catch (IOException e) {
                     createPromise.completeExceptionally(e);
@@ -709,6 +713,7 @@ public class FederatedZKLogMetadataStore
         } catch (ZooKeeperClient.ZooKeeperConnectionException e) {
             fetchPromise.completeExceptionally(e);
         } catch (InterruptedException e) {
+            Thread.currentThread().interrupt();
             fetchPromise.completeExceptionally(e);
         }
         return fetchPromise;
diff --git 
a/stream/distributedlog/core/src/main/java/org/apache/distributedlog/impl/metadata/ZKLogStreamMetadataStore.java
 
b/stream/distributedlog/core/src/main/java/org/apache/distributedlog/impl/metadata/ZKLogStreamMetadataStore.java
index c046fc6..d8d7674 100644
--- 
a/stream/distributedlog/core/src/main/java/org/apache/distributedlog/impl/metadata/ZKLogStreamMetadataStore.java
+++ 
b/stream/distributedlog/core/src/main/java/org/apache/distributedlog/impl/metadata/ZKLogStreamMetadataStore.java
@@ -213,6 +213,7 @@ public class ZKLogStreamMetadataStore implements 
LogStreamMetadataStore {
             }, null);
 
         } catch (InterruptedException ie) {
+            Thread.currentThread().interrupt();
             LOG.error("Interrupted while reading {}", logSegmentsPath, ie);
             promise.completeExceptionally(new 
DLInterruptedException("Interrupted while checking "
                     + logSegmentsPath, ie));
@@ -616,6 +617,7 @@ public class ZKLogStreamMetadataStore implements 
LogStreamMetadataStore {
                     new ZKException("Encountered zookeeper connection issue on 
creating log "
                             + logName, KeeperException.Code.CONNECTIONLOSS));
         } catch (InterruptedException e) {
+            Thread.currentThread().interrupt();
             return FutureUtils.exception(new 
DLInterruptedException("Interrupted on creating log " + logName, e));
         }
     }
@@ -660,6 +662,7 @@ public class ZKLogStreamMetadataStore implements 
LogStreamMetadataStore {
                     new ZKException("Encountered zookeeper issue on deleting 
log stream "
                             + logName, KeeperException.Code.CONNECTIONLOSS));
         } catch (InterruptedException e) {
+            Thread.currentThread().interrupt();
             FutureUtils.completeExceptionally(promise,
                     new DLInterruptedException("Interrupted while deleting log 
stream " + logName));
         } catch (KeeperException e) {
@@ -872,6 +875,7 @@ public class ZKLogStreamMetadataStore implements 
LogStreamMetadataStore {
         } catch (ZooKeeperConnectionException e) {
             future.completeExceptionally(e);
         } catch (InterruptedException e) {
+            Thread.currentThread().interrupt();
             future.completeExceptionally(e);
         }
         return future;
@@ -940,6 +944,7 @@ public class ZKLogStreamMetadataStore implements 
LogStreamMetadataStore {
         } catch (ZooKeeperConnectionException e) {
             future.completeExceptionally(e);
         } catch (InterruptedException e) {
+            Thread.currentThread().interrupt();
             future.completeExceptionally(e);
         }
         return future;
diff --git 
a/stream/distributedlog/core/src/main/java/org/apache/distributedlog/impl/metadata/ZkMetadataResolver.java
 
b/stream/distributedlog/core/src/main/java/org/apache/distributedlog/impl/metadata/ZkMetadataResolver.java
index aaa5461..ca1dad3 100644
--- 
a/stream/distributedlog/core/src/main/java/org/apache/distributedlog/impl/metadata/ZkMetadataResolver.java
+++ 
b/stream/distributedlog/core/src/main/java/org/apache/distributedlog/impl/metadata/ZkMetadataResolver.java
@@ -59,6 +59,7 @@ public class ZkMetadataResolver implements MetadataResolver {
             } catch (KeeperException ke) {
                 throw new IOException("Fail to resolve dl path : " + 
pathToResolve);
             } catch (InterruptedException ie) {
+                Thread.currentThread().interrupt();
                 throw new IOException("Interrupted when resolving dl path : " 
+ pathToResolve);
             }
             if (null == data || data.length == 0) {
diff --git 
a/stream/distributedlog/core/src/main/java/org/apache/distributedlog/impl/subscription/ZKSubscriptionStateStore.java
 
b/stream/distributedlog/core/src/main/java/org/apache/distributedlog/impl/subscription/ZKSubscriptionStateStore.java
index 5354ac5..dd8754d 100644
--- 
a/stream/distributedlog/core/src/main/java/org/apache/distributedlog/impl/subscription/ZKSubscriptionStateStore.java
+++ 
b/stream/distributedlog/core/src/main/java/org/apache/distributedlog/impl/subscription/ZKSubscriptionStateStore.java
@@ -93,6 +93,7 @@ public class ZKSubscriptionStateStore implements 
SubscriptionStateStore {
         } catch (ZooKeeperClient.ZooKeeperConnectionException zkce) {
             result.completeExceptionally(zkce);
         } catch (InterruptedException ie) {
+            Thread.currentThread().interrupt();
             result.completeExceptionally(new 
DLInterruptedException("getLastCommitPosition was interrupted", ie));
         }
         return result;
diff --git 
a/stream/distributedlog/core/src/main/java/org/apache/distributedlog/impl/subscription/ZKSubscriptionsStore.java
 
b/stream/distributedlog/core/src/main/java/org/apache/distributedlog/impl/subscription/ZKSubscriptionsStore.java
index ad4d7b3..c2c90fc 100644
--- 
a/stream/distributedlog/core/src/main/java/org/apache/distributedlog/impl/subscription/ZKSubscriptionsStore.java
+++ 
b/stream/distributedlog/core/src/main/java/org/apache/distributedlog/impl/subscription/ZKSubscriptionsStore.java
@@ -101,6 +101,7 @@ public class ZKSubscriptionsStore implements 
SubscriptionsStore {
         } catch (ZooKeeperClient.ZooKeeperConnectionException zkce) {
             result.completeExceptionally(zkce);
         } catch (InterruptedException ie) {
+            Thread.currentThread().interrupt();
             result.completeExceptionally(new 
DLInterruptedException("getLastCommitPositions was interrupted", ie));
         }
         return result;
diff --git 
a/stream/distributedlog/core/src/main/java/org/apache/distributedlog/injector/RandomDelayFailureInjector.java
 
b/stream/distributedlog/core/src/main/java/org/apache/distributedlog/injector/RandomDelayFailureInjector.java
index 7fc567e..e11794d 100644
--- 
a/stream/distributedlog/core/src/main/java/org/apache/distributedlog/injector/RandomDelayFailureInjector.java
+++ 
b/stream/distributedlog/core/src/main/java/org/apache/distributedlog/injector/RandomDelayFailureInjector.java
@@ -54,6 +54,7 @@ public class RandomDelayFailureInjector implements 
FailureInjector {
                 Thread.sleep(delayMs());
             }
         } catch (InterruptedException ex) {
+            Thread.currentThread().interrupt();
             LOG.warn("delay was interrupted ", ex);
         }
     }
diff --git 
a/stream/distributedlog/core/src/main/java/org/apache/distributedlog/lock/ZKSessionLock.java
 
b/stream/distributedlog/core/src/main/java/org/apache/distributedlog/lock/ZKSessionLock.java
index d9f3b2c..2d92152 100644
--- 
a/stream/distributedlog/core/src/main/java/org/apache/distributedlog/lock/ZKSessionLock.java
+++ 
b/stream/distributedlog/core/src/main/java/org/apache/distributedlog/lock/ZKSessionLock.java
@@ -322,6 +322,7 @@ class ZKSessionLock implements SessionLock {
             throw new ZKException("Failed to get zookeeper client for lock " + 
lockPath,
                     KeeperException.Code.CONNECTIONLOSS);
         } catch (InterruptedException e) {
+            Thread.currentThread().interrupt();
             throw new DLInterruptedException("Interrupted on getting zookeeper 
client for lock " + lockPath, e);
         }
         this.lockPath = lockPath;
diff --git 
a/stream/distributedlog/core/src/main/java/org/apache/distributedlog/metadata/DLMetadata.java
 
b/stream/distributedlog/core/src/main/java/org/apache/distributedlog/metadata/DLMetadata.java
index 0bb2079..ca4c36f 100644
--- 
a/stream/distributedlog/core/src/main/java/org/apache/distributedlog/metadata/DLMetadata.java
+++ 
b/stream/distributedlog/core/src/main/java/org/apache/distributedlog/metadata/DLMetadata.java
@@ -118,6 +118,7 @@ public class DLMetadata {
             throw new IOException("Fail to update dl metadata " + new 
String(data, UTF_8)
                     + " to uri " + uri, e);
         } catch (InterruptedException e) {
+            Thread.currentThread().interrupt();
             throw new IOException("Interrupted when updating dl metadata "
                     + new String(data, UTF_8) + " to uri " + uri, e);
         } finally {
@@ -169,6 +170,7 @@ public class DLMetadata {
         } catch (KeeperException ke) {
             throw new IOException("Fail to unbound dl metadata on uri " + uri, 
ke);
         } catch (InterruptedException ie) {
+            Thread.currentThread().interrupt();
             throw new IOException("Interrupted when unbinding dl metadata on 
uri " + uri, ie);
         } finally {
             zkc.close();
diff --git 
a/stream/distributedlog/core/src/main/java/org/apache/distributedlog/util/Utils.java
 
b/stream/distributedlog/core/src/main/java/org/apache/distributedlog/util/Utils.java
index 8b18e02..155baaf 100644
--- 
a/stream/distributedlog/core/src/main/java/org/apache/distributedlog/util/Utils.java
+++ 
b/stream/distributedlog/core/src/main/java/org/apache/distributedlog/util/Utils.java
@@ -120,6 +120,7 @@ public class Utils {
         } catch (KeeperException ke) {
             throw ke;
         } catch (InterruptedException ie) {
+            Thread.currentThread().interrupt();
             throw new DLInterruptedException("Interrupted on create zookeeper 
path " + path, ie);
         } catch (RuntimeException rte) {
             throw rte;
@@ -194,6 +195,7 @@ public class Utils {
             
callback.processResult(DistributedLogConstants.ZK_CONNECTION_EXCEPTION_RESULT_CODE,
                     zkce.getMessage(), ctx, pathToCreate);
         } catch (InterruptedException ie) {
+            Thread.currentThread().interrupt();
             
callback.processResult(DistributedLogConstants.DL_INTERRUPTED_EXCEPTION_RESULT_CODE,
                     ie.getMessage(), ctx, pathToCreate);
         }
@@ -316,6 +318,7 @@ public class Utils {
         } catch (ZooKeeperClient.ZooKeeperConnectionException e) {
             return FutureUtils.exception(zkException(e, path));
         } catch (InterruptedException e) {
+            Thread.currentThread().interrupt();
             return FutureUtils.exception(zkException(e, path));
         }
         return zkGetData(zk, path, watch);
@@ -359,6 +362,7 @@ public class Utils {
         } catch (ZooKeeperClient.ZooKeeperConnectionException e) {
             return FutureUtils.exception(zkException(e, path));
         } catch (InterruptedException e) {
+            Thread.currentThread().interrupt();
             return FutureUtils.exception(zkException(e, path));
         }
         return zkSetData(zk, path, data, version);
@@ -402,6 +406,7 @@ public class Utils {
         } catch (ZooKeeperClient.ZooKeeperConnectionException e) {
             return FutureUtils.exception(zkException(e, path));
         } catch (InterruptedException e) {
+            Thread.currentThread().interrupt();
             return FutureUtils.exception(zkException(e, path));
         }
         return zkDelete(zk, path, version);
@@ -455,6 +460,7 @@ public class Utils {
         } catch (ZooKeeperClient.ZooKeeperConnectionException e) {
             return FutureUtils.exception(zkException(e, path));
         } catch (InterruptedException e) {
+            Thread.currentThread().interrupt();
             return FutureUtils.exception(zkException(e, path));
         }
         final CompletableFuture<Boolean> promise = new 
CompletableFuture<Boolean>();
@@ -499,6 +505,7 @@ public class Utils {
         try {
             zk = zkc.get();
         } catch (InterruptedException e) {
+            Thread.currentThread().interrupt();
             throw new DLInterruptedException("Interrupted on checking if log " 
+ path + " exists", e);
         }
         final CountDownLatch syncLatch = new CountDownLatch(1);
@@ -513,6 +520,7 @@ public class Utils {
         try {
             syncLatch.await();
         } catch (InterruptedException e) {
+            Thread.currentThread().interrupt();
             throw new DLInterruptedException("Interrupted on syncing zookeeper 
connection", e);
         }
         if (KeeperException.Code.OK.intValue() != syncResult.get()) {
diff --git 
a/stream/distributedlog/core/src/main/java/org/apache/distributedlog/zk/ZKTransaction.java
 
b/stream/distributedlog/core/src/main/java/org/apache/distributedlog/zk/ZKTransaction.java
index 3502906..bd2a2d1 100644
--- 
a/stream/distributedlog/core/src/main/java/org/apache/distributedlog/zk/ZKTransaction.java
+++ 
b/stream/distributedlog/core/src/main/java/org/apache/distributedlog/zk/ZKTransaction.java
@@ -68,6 +68,7 @@ public class ZKTransaction implements Transaction<Object>, 
AsyncCallback.MultiCa
         } catch (ZooKeeperClient.ZooKeeperConnectionException e) {
             result.completeExceptionally(Utils.zkException(e, ""));
         } catch (InterruptedException e) {
+            Thread.currentThread().interrupt();
             result.completeExceptionally(Utils.zkException(e, ""));
         }
         return result;
diff --git 
a/stream/distributedlog/core/src/main/java/org/apache/distributedlog/zk/ZKWatcherManager.java
 
b/stream/distributedlog/core/src/main/java/org/apache/distributedlog/zk/ZKWatcherManager.java
index 759cf79..fe8eed4 100644
--- 
a/stream/distributedlog/core/src/main/java/org/apache/distributedlog/zk/ZKWatcherManager.java
+++ 
b/stream/distributedlog/core/src/main/java/org/apache/distributedlog/zk/ZKWatcherManager.java
@@ -182,6 +182,7 @@ public class ZKWatcherManager implements Watcher {
                         }, null);
                     }
                 } catch (InterruptedException e) {
+                    Thread.currentThread().interrupt();
                     logger.debug("Encountered exception on removing watches 
from {}", path, e);
                 } catch (ZooKeeperClient.ZooKeeperConnectionException e) {
                     logger.debug("Encountered exception on removing watches 
from {}", path, e);
diff --git 
a/stream/distributedlog/core/src/test/java/org/apache/distributedlog/TestBKLogSegmentWriter.java
 
b/stream/distributedlog/core/src/test/java/org/apache/distributedlog/TestBKLogSegmentWriter.java
index eca283d..7b04b25 100644
--- 
a/stream/distributedlog/core/src/test/java/org/apache/distributedlog/TestBKLogSegmentWriter.java
+++ 
b/stream/distributedlog/core/src/test/java/org/apache/distributedlog/TestBKLogSegmentWriter.java
@@ -532,6 +532,7 @@ public class TestBKLogSegmentWriter extends 
TestDistributedLogBase {
             try {
                 deferLatch.await();
             } catch (InterruptedException e) {
+                Thread.currentThread().interrupt();
                 LOG.warn("Interrupted on deferring completion : ", e);
             }
         });
diff --git 
a/stream/distributedlog/core/src/test/java/org/apache/distributedlog/TestNonBlockingReadsMultiReader.java
 
b/stream/distributedlog/core/src/test/java/org/apache/distributedlog/TestNonBlockingReadsMultiReader.java
index 0fd1da4..854465b 100644
--- 
a/stream/distributedlog/core/src/test/java/org/apache/distributedlog/TestNonBlockingReadsMultiReader.java
+++ 
b/stream/distributedlog/core/src/test/java/org/apache/distributedlog/TestNonBlockingReadsMultiReader.java
@@ -75,6 +75,7 @@ public class TestNonBlockingReadsMultiReader extends 
TestDistributedLogBase {
             try {
                 join();
             } catch (InterruptedException e) {
+                Thread.currentThread().interrupt();
                 LOG.error("Interrupted on waiting reader thread {} exiting : 
", getName(), e);
             }
         }
diff --git 
a/stream/distributedlog/core/src/test/java/org/apache/distributedlog/TestZooKeeperClient.java
 
b/stream/distributedlog/core/src/test/java/org/apache/distributedlog/TestZooKeeperClient.java
index 777e9ec..5f3dae4 100644
--- 
a/stream/distributedlog/core/src/test/java/org/apache/distributedlog/TestZooKeeperClient.java
+++ 
b/stream/distributedlog/core/src/test/java/org/apache/distributedlog/TestZooKeeperClient.java
@@ -448,6 +448,7 @@ public class TestZooKeeperClient extends 
ZooKeeperClusterTestCase {
                 try {
                     latch.await();
                 } catch (InterruptedException e) {
+                    Thread.currentThread().interrupt();
                 }
             }
         });
diff --git 
a/stream/distributedlog/core/src/test/java/org/apache/distributedlog/lock/TestZKSessionLock.java
 
b/stream/distributedlog/core/src/test/java/org/apache/distributedlog/lock/TestZKSessionLock.java
index ea13cce..9e4e1e2 100644
--- 
a/stream/distributedlog/core/src/test/java/org/apache/distributedlog/lock/TestZKSessionLock.java
+++ 
b/stream/distributedlog/core/src/test/java/org/apache/distributedlog/lock/TestZKSessionLock.java
@@ -325,6 +325,7 @@ public class TestZKSessionLock extends 
ZooKeeperClusterTestCase {
             try {
                 Thread.sleep(timeout);
             } catch (InterruptedException ie) {
+                Thread.currentThread().interrupt();
             }
             return true;
         }

-- 
To stop receiving notification emails like this one, please contact
si...@apache.org.

Reply via email to