From 57773765d779efba76764188ec65ef3f45ca1977 Mon Sep 17 00:00:00 2001 From: Hannes Greule Date: Fri, 16 Apr 2021 20:27:42 +0200 Subject: [PATCH] Prevent exceptions from being thrown endlessly --- .../implementation/queue/SingleThreadQueueExtent.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/worldedit-core/src/main/java/com/boydti/fawe/beta/implementation/queue/SingleThreadQueueExtent.java b/worldedit-core/src/main/java/com/boydti/fawe/beta/implementation/queue/SingleThreadQueueExtent.java index 4b0e7b2ab..95db06861 100644 --- a/worldedit-core/src/main/java/com/boydti/fawe/beta/implementation/queue/SingleThreadQueueExtent.java +++ b/worldedit-core/src/main/java/com/boydti/fawe/beta/implementation/queue/SingleThreadQueueExtent.java @@ -336,8 +336,9 @@ public class SingleThreadQueueExtent extends ExtentBatchProcessorHolder implemen Future next = submissions.peek(); while (next != null) { if (next.isDone()) { + Future after = null; try { - next = (Future) next.get(); + after = (Future) next.get(); } catch (FaweException messageOnly) { LOGGER.warn(messageOnly.getMessage()); } catch (ExecutionException e) { @@ -350,6 +351,13 @@ public class SingleThreadQueueExtent extends ExtentBatchProcessorHolder implemen e.getCause().printStackTrace(); } catch (InterruptedException e) { e.printStackTrace(); + } finally { + /* + * If the execution failed, namely next.get() threw an exception, + * we don't want to process that Future again. Instead, we just drop + * it and set it to null, otherwise to the returned next Future. + */ + next = after; } } else { return;