Give each plugin its own executor service (#1010)

This is part of preparatory work for Velocity 5.0.0's revamped event system, but this change is safe to bring into the 3.x.x series. This affects the scheduler for now, but command execution will also be moved into the per-plugin thread pool, along with invocations of `EventTask.async()`.
This commit is contained in:
Andrew Steinborn
2023-05-14 02:51:25 -04:00
committed by GitHub
parent 7f776abf55
commit a29c753e39
6 changed files with 135 additions and 44 deletions

View File

@@ -8,6 +8,7 @@
package com.velocitypowered.api.plugin;
import java.util.Optional;
import java.util.concurrent.ExecutorService;
/**
* A wrapper around a plugin loaded by the proxy.
@@ -29,4 +30,12 @@ public interface PluginContainer {
default Optional<?> getInstance() {
return Optional.empty();
}
/**
* Returns an executor service for this plugin. The executor will use a cached
* thread pool.
*
* @return an {@link ExecutorService} associated with this plugin
*/
ExecutorService getExecutorService();
}