Skip to content

Commit

Permalink
Update ProgressTracker.java
Browse files Browse the repository at this point in the history
added InterruptedException handling
  • Loading branch information
srozsnyai committed Jul 16, 2024
1 parent 2080195 commit 9225c1b
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,10 @@ public void run() {
int percent = (int) Math.ceil(((double) currentIt / maxIt) * 100.0);
print_progress(percent);
}
sleep(SLEEP_TIME_POLL);

if (sleep(SLEEP_TIME_POLL) == true) {
break;
}
}
print_progress(100);
}
Expand All @@ -64,11 +67,13 @@ public void print_progress(int percent) {
System.out.print("\r" + bar.toString());
}

private void sleep(int sleeptime) {
private boolean sleep(int sleeptime) {
try {
Thread.sleep(sleeptime);
} catch (InterruptedException e) {
e.printStackTrace();
return true;
}
return false;
}
}

0 comments on commit 9225c1b

Please sign in to comment.