bharathv commented on a change in pull request #934: HBASE-23568: Improve
Threading of Replication
URL: https://github.com/apache/hbase/pull/934#discussion_r376665200
##########
File path:
hbase-server/src/main/java/org/apache/hadoop/hbase/replication/regionserver/ReplicationSource.java
##########
@@ -585,50 +626,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,
+ workerThreads.values().size() * this.sleepForRetries, TimeUnit.SECONDS);
+ if (!shutdownSuccess) {
+ LOG.info("{} Unable to shutdown thread pool completely", logPeerId());
Review comment:
nit: Shouldn't this be a warn?
----------------------------------------------------------------
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