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

 ##########
 File path: 
hbase-server/src/main/java/org/apache/hadoop/hbase/replication/regionserver/ReplicationSource.java
 ##########
 @@ -585,50 +622,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());
 
 Review comment:
   Nah, Workers are assigned a reader.  It is the worker's responsibility to 
close the reader when it is safe to do so.

----------------------------------------------------------------
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