HDFS-12152: [SPS]: Re-arrange StoragePolicySatisfyWorker stopping sequence to improve thread cleanup time. Contributed by Rakesh R.
This commit is contained in:
parent
4bcf61c696
commit
3b601f2c0e
@ -77,7 +77,8 @@ public void run() {
|
|||||||
moverTaskFutures.wait(2000);
|
moverTaskFutures.wait(2000);
|
||||||
}
|
}
|
||||||
} catch (InterruptedException ignore) {
|
} catch (InterruptedException ignore) {
|
||||||
// ignore
|
// Sets interrupt flag of this thread.
|
||||||
|
Thread.currentThread().interrupt();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
@ -102,12 +103,19 @@ public void run() {
|
|||||||
synchronized (moverTaskFutures) {
|
synchronized (moverTaskFutures) {
|
||||||
moverTaskFutures.remove(trackId);
|
moverTaskFutures.remove(trackId);
|
||||||
}
|
}
|
||||||
|
if (running) {
|
||||||
// handle completed or inprogress blocks movements per trackId.
|
// handle completed or inprogress blocks movements per trackId.
|
||||||
blksMovementsStatusHandler.handle(resultPerTrackIdList);
|
blksMovementsStatusHandler.handle(resultPerTrackIdList);
|
||||||
|
}
|
||||||
movementResults.remove(trackId);
|
movementResults.remove(trackId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (ExecutionException | InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
|
if (running) {
|
||||||
|
LOG.error("Exception while moving block replica to target storage"
|
||||||
|
+ " type", e);
|
||||||
|
}
|
||||||
|
} catch (ExecutionException e) {
|
||||||
// TODO: Do we need failure retries and implement the same if required.
|
// TODO: Do we need failure retries and implement the same if required.
|
||||||
LOG.error("Exception while moving block replica to target storage type",
|
LOG.error("Exception while moving block replica to target storage type",
|
||||||
e);
|
e);
|
||||||
|
@ -137,8 +137,8 @@ void start() {
|
|||||||
* thread.
|
* thread.
|
||||||
*/
|
*/
|
||||||
void stop() {
|
void stop() {
|
||||||
movementTrackerThread.interrupt();
|
|
||||||
movementTracker.stopTracking();
|
movementTracker.stopTracking();
|
||||||
|
movementTrackerThread.interrupt();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -147,7 +147,8 @@ void stop() {
|
|||||||
void waitToFinishWorkerThread() {
|
void waitToFinishWorkerThread() {
|
||||||
try {
|
try {
|
||||||
movementTrackerThread.join(3000);
|
movementTrackerThread.join(3000);
|
||||||
} catch (InterruptedException ie) {
|
} catch (InterruptedException ignore) {
|
||||||
|
// ignore
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user