Mirror von
https://github.com/PaperMC/Velocity.git
synchronisiert 2024-12-24 15:20:35 +01:00
check if a plugin has a executor service (#1038)
* check if a plugin has an executor service * checkstyle
Dieser Commit ist enthalten in:
Ursprung
37fedf508e
Commit
be9ecf75b2
@ -71,4 +71,8 @@ public class VelocityPluginContainer implements PluginContainer {
|
||||
|
||||
return this.service;
|
||||
}
|
||||
|
||||
public boolean hasExecutorService() {
|
||||
return this.service != null;
|
||||
}
|
||||
}
|
||||
|
@ -30,9 +30,12 @@ import com.velocitypowered.api.scheduler.ScheduledTask;
|
||||
import com.velocitypowered.api.scheduler.Scheduler;
|
||||
import com.velocitypowered.api.scheduler.TaskStatus;
|
||||
import com.velocitypowered.proxy.plugin.loader.VelocityPluginContainer;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.HashSet;
|
||||
import java.util.IdentityHashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
@ -116,17 +119,24 @@ public class VelocityScheduler implements Scheduler {
|
||||
task.cancel();
|
||||
}
|
||||
timerExecutionService.shutdown();
|
||||
for (final PluginContainer container : this.pluginManager.getPlugins()) {
|
||||
final List<PluginContainer> plugins = new ArrayList<>(this.pluginManager.getPlugins());
|
||||
final Iterator<PluginContainer> pluginIterator = plugins.iterator();
|
||||
while (pluginIterator.hasNext()) {
|
||||
final PluginContainer container = pluginIterator.next();
|
||||
if (container instanceof VelocityPluginContainer) {
|
||||
(container).getExecutorService().shutdown();
|
||||
final VelocityPluginContainer pluginContainer = (VelocityPluginContainer) container;
|
||||
if (pluginContainer.hasExecutorService()) {
|
||||
container.getExecutorService().shutdown();
|
||||
} else {
|
||||
pluginIterator.remove();
|
||||
}
|
||||
} else {
|
||||
pluginIterator.remove();
|
||||
}
|
||||
}
|
||||
|
||||
boolean allShutdown = true;
|
||||
for (final PluginContainer container : this.pluginManager.getPlugins()) {
|
||||
if (!(container instanceof VelocityPluginContainer)) {
|
||||
continue;
|
||||
}
|
||||
for (final PluginContainer container : plugins) {
|
||||
final String id = container.getDescription().getId();
|
||||
final ExecutorService service = (container).getExecutorService();
|
||||
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren