3
0
Mirror von https://github.com/IntellectualSites/FastAsyncWorldEdit.git synchronisiert 2024-11-02 17:40:09 +01:00

Don't print stack trace of FaweExceptions from submitted chunks

Addresses #353
Dieser Commit ist enthalten in:
dordsor21 2021-01-13 20:30:22 +00:00
Ursprung be9866ddb3
Commit 05d7558873
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 1E53E88969FFCF0B

Datei anzeigen

@ -16,11 +16,14 @@ import com.boydti.fawe.beta.implementation.processors.EmptyBatchProcessor;
import com.boydti.fawe.beta.implementation.processors.ExtentBatchProcessorHolder; import com.boydti.fawe.beta.implementation.processors.ExtentBatchProcessorHolder;
import com.boydti.fawe.beta.implementation.processors.ProcessorScope; import com.boydti.fawe.beta.implementation.processors.ProcessorScope;
import com.boydti.fawe.config.Settings; import com.boydti.fawe.config.Settings;
import com.boydti.fawe.object.exception.FaweException;
import com.boydti.fawe.util.MathMan; import com.boydti.fawe.util.MathMan;
import com.boydti.fawe.util.MemUtil; import com.boydti.fawe.util.MemUtil;
import com.google.common.util.concurrent.Futures; import com.google.common.util.concurrent.Futures;
import com.sk89q.worldedit.extent.Extent; import com.sk89q.worldedit.extent.Extent;
import it.unimi.dsi.fastutil.longs.Long2ObjectLinkedOpenHashMap; import it.unimi.dsi.fastutil.longs.Long2ObjectLinkedOpenHashMap;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.concurrent.ConcurrentLinkedQueue; import java.util.concurrent.ConcurrentLinkedQueue;
import java.util.concurrent.ExecutionException; import java.util.concurrent.ExecutionException;
@ -35,6 +38,9 @@ import java.util.concurrent.locks.ReentrantLock;
*/ */
public class SingleThreadQueueExtent extends ExtentBatchProcessorHolder implements IQueueExtent<IQueueChunk> { public class SingleThreadQueueExtent extends ExtentBatchProcessorHolder implements IQueueExtent<IQueueChunk> {
// Don't bother with the full classpath.
private static final Logger log = LoggerFactory.getLogger("SingleThreadQueueExtent");
// Pool discarded chunks for reuse (can safely be cleared by another thread) // Pool discarded chunks for reuse (can safely be cleared by another thread)
// private static final ConcurrentLinkedQueue<IChunk> CHUNK_POOL = new ConcurrentLinkedQueue<>(); // private static final ConcurrentLinkedQueue<IChunk> CHUNK_POOL = new ConcurrentLinkedQueue<>();
// Chunks currently being queued / worked on // Chunks currently being queued / worked on
@ -291,7 +297,15 @@ public class SingleThreadQueueExtent extends ExtentBatchProcessorHolder implemen
while (future != null) { while (future != null) {
future = (Future) future.get(); future = (Future) future.get();
} }
} catch (InterruptedException | ExecutionException e) { } catch (FaweException messageOnly) {
log.warn(messageOnly.getMessage());
} catch (ExecutionException e) {
if (e.getCause() instanceof FaweException) {
log.warn(e.getCause().getClass().getCanonicalName() + ": " + e.getCause().getMessage());
} else {
e.printStackTrace();
}
} catch (InterruptedException e) {
e.printStackTrace(); e.printStackTrace();
} }
} }
@ -302,7 +316,15 @@ public class SingleThreadQueueExtent extends ExtentBatchProcessorHolder implemen
while (first != null) { while (first != null) {
first = (Future) first.get(); first = (Future) first.get();
} }
} catch (InterruptedException | ExecutionException e) { } catch (FaweException messageOnly) {
log.warn(messageOnly.getMessage());
} catch (ExecutionException e) {
if (e.getCause() instanceof FaweException) {
log.warn(e.getCause().getClass().getCanonicalName() + ": " + e.getCause().getMessage());
} else {
e.printStackTrace();
}
} catch (InterruptedException e) {
e.printStackTrace(); e.printStackTrace();
} }
} }
@ -313,7 +335,15 @@ public class SingleThreadQueueExtent extends ExtentBatchProcessorHolder implemen
if (next.isDone()) { if (next.isDone()) {
try { try {
next = (Future) next.get(); next = (Future) next.get();
} catch (InterruptedException | ExecutionException e) { } catch (FaweException messageOnly) {
log.warn(messageOnly.getMessage());
} catch (ExecutionException e) {
if (e.getCause() instanceof FaweException) {
log.warn(e.getCause().getClass().getCanonicalName() + ": " + e.getCause().getMessage());
} else {
e.printStackTrace();
}
} catch (InterruptedException e) {
e.printStackTrace(); e.printStackTrace();
} }
} else { } else {