Catch all progress tracker errors

This commit is contained in:
Jesse Boyd 2016-09-26 13:52:25 +10:00
parent f8a606c783
commit 9e6c90430d
3 changed files with 15 additions and 3 deletions

View File

@ -26,7 +26,11 @@ public class DefaultFaweQueueMap implements IFaweQueueMap {
@Override
public FaweChunk put(Long key, FaweChunk value) {
if (parent.getProgressTask() != null) {
try {
parent.getProgressTask().run(FaweQueue.ProgressType.QUEUE, size() + 1);
} catch (Throwable e) {
e.printStackTrace();
}
}
return super.put(key, value);
}

View File

@ -205,7 +205,11 @@ public abstract class MappedFaweQueue<WORLD, CHUNK, SECTION> extends FaweQueue {
public void runTasks() {
super.runTasks();
if (getProgressTask() != null) {
try {
getProgressTask().run(ProgressType.DONE, 1);
} catch (Throwable e) {
e.printStackTrace();
}
}
ArrayDeque<Runnable> tmp = new ArrayDeque<>(tasks);
tasks.clear();

View File

@ -397,7 +397,11 @@ public abstract class FaweQueue {
this.notifyAll();
}
if (getProgressTask() != null) {
try {
getProgressTask().run(ProgressType.DONE, 1);
} catch (Throwable e) {
e.printStackTrace();
}
}
while (!tasks.isEmpty()) {
Runnable task = tasks.poll();