Catch RejectedExecutionException in BufferedRequest (#2289)

This commit is contained in:
Luck 2020-05-11 21:15:42 +01:00
parent 9984d4be42
commit c7a0e59919
No known key found for this signature in database
GPG Key ID: EFA9B3EC5FD90F8B
2 changed files with 11 additions and 1 deletions

View File

@ -63,6 +63,10 @@ public class BukkitCommandListUpdater {
// Called when a user's data is recalculated.
public void onUserDataRecalculate(UserDataRecalculateEvent e) {
if (this.plugin.getBootstrap().isServerStopping()) {
return;
}
UUID uniqueId = e.getUser().getUniqueId();
if (!this.plugin.getBootstrap().isPlayerOnline(uniqueId)) {
return;

View File

@ -29,6 +29,7 @@ import me.lucko.luckperms.common.plugin.scheduler.SchedulerAdapter;
import me.lucko.luckperms.common.plugin.scheduler.SchedulerTask;
import java.util.concurrent.CompletableFuture;
import java.util.concurrent.RejectedExecutionException;
import java.util.concurrent.TimeUnit;
import java.util.function.Supplier;
@ -139,7 +140,12 @@ public abstract class BufferedRequest<T> {
private void scheduleTask() {
this.boundTask = new CompletionTask();
this.scheduledTask = this.schedulerAdapter.asyncLater(this.boundTask, this.delay, this.unit);
try {
this.scheduledTask = this.schedulerAdapter.asyncLater(this.boundTask, this.delay, this.unit);
} catch (RejectedExecutionException e) {
// If we can't schedule the completion in the future, just do it now.
this.boundTask.run();
}
}
CompletableFuture<R> getFuture() {