Mirror von
https://github.com/IntellectualSites/FastAsyncWorldEdit.git
synchronisiert 2024-12-25 18:40:05 +01:00
fix: add timeout to reading history from exchanger (#2920)
Dieser Commit ist enthalten in:
Ursprung
7e75ce78ec
Commit
393f80165c
@ -4,6 +4,8 @@ import com.sk89q.worldedit.history.change.Change;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
|
||||
import java.util.concurrent.Exchanger;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.TimeoutException;
|
||||
import java.util.function.BiConsumer;
|
||||
|
||||
/**
|
||||
@ -32,8 +34,9 @@ public class ChangeExchangeCoordinator implements AutoCloseable {
|
||||
.start(() -> this.runnerTask.accept(this.exchanger, new Change[length]));
|
||||
}
|
||||
try {
|
||||
return exchanger.exchange(consumed);
|
||||
} catch (InterruptedException e) {
|
||||
// Allow a reasonable timeout in case of weirdness
|
||||
return exchanger.exchange(consumed, 30, TimeUnit.SECONDS);
|
||||
} catch (InterruptedException | TimeoutException e) {
|
||||
this.runner.interrupt();
|
||||
Thread.currentThread().interrupt();
|
||||
return null;
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren