belugabehr commented on a change in pull request #934: HBASE-23568: Improve 
Threading of Replication
URL: https://github.com/apache/hbase/pull/934#discussion_r375860573
 
 

 ##########
 File path: 
hbase-server/src/main/java/org/apache/hadoop/hbase/replication/regionserver/ReplicationSource.java
 ##########
 @@ -575,50 +609,24 @@ public void terminate(String reason, Exception cause, 
boolean clearMetrics, bool
       initThread.interrupt();
       Threads.shutdown(initThread, this.sleepForRetries);
     }
-    Collection<ReplicationSourceShipper> workers = workerThreads.values();
-    for (ReplicationSourceShipper worker : workers) {
-      worker.stopWorker();
-      if(worker.entryReader != null) {
-        worker.entryReader.setReaderRunning(false);
-      }
-    }
 
-    for (ReplicationSourceShipper worker : workers) {
-      if (worker.isAlive() || worker.entryReader.isAlive()) {
-        try {
-          // Wait worker to stop
-          Thread.sleep(this.sleepForRetries);
-        } catch (InterruptedException e) {
-          LOG.info("{} Interrupted while waiting {} to stop", logPeerId(), 
worker.getName());
-          Thread.currentThread().interrupt();
-        }
-        // If worker still is alive after waiting, interrupt it
-        if (worker.isAlive()) {
-          worker.interrupt();
-        }
-        // If entry reader is alive after waiting, interrupt it
-        if (worker.entryReader.isAlive()) {
-          worker.entryReader.interrupt();
-        }
-      }
+    this.workerThreads.values().forEach(worker -> worker.stopWorker());
+
+    final boolean shutdownSuccess = 
MoreExecutors.shutdownAndAwaitTermination(this.executorService,
+      10L, TimeUnit.SECONDS);
 
 Review comment:
   Changed to be based on the number of workerThreads.  Thanks.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to