Skip to content

Commit

Permalink
TEZ-4270: HeartbeatHandlerBase Does Not Need Stop Condition (#93) (Da…
Browse files Browse the repository at this point in the history
…vid Mollitor reviewed by Laszlo Bodor)
  • Loading branch information
belugabehr authored Dec 26, 2021
1 parent 8f846dc commit c9b8e90
Showing 1 changed file with 2 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ public abstract class HeartbeatHandlerBase<T> extends AbstractService {
protected final AppContext appContext;

private ConcurrentMap<T, ReportTime> runningMap;
private volatile boolean stopped;

public HeartbeatHandlerBase(AppContext appContext, int expectedConcurrency, String name) {
super(name);
Expand Down Expand Up @@ -70,7 +69,6 @@ public void serviceStart() {

@Override
public void serviceStop() {
stopped = true;
if (timeOutCheckerThread != null) {
timeOutCheckerThread.interrupt();
}
Expand Down Expand Up @@ -140,7 +138,7 @@ private class PingChecker implements Runnable {

@Override
public void run() {
while (!stopped && !Thread.currentThread().isInterrupted()) {
while (!Thread.currentThread().isInterrupted()) {
Iterator<Map.Entry<T, ReportTime>> iterator =
runningMap.entrySet().iterator();

Expand All @@ -158,7 +156,7 @@ public void run() {
try {
Thread.sleep(timeOutCheckInterval);
} catch (InterruptedException e) {
break;
Thread.currentThread().interrupt();
}
}
}
Expand Down

0 comments on commit c9b8e90

Please sign in to comment.