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:
@@ -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();
|
||||
}
|
||||
|
Reference in New Issue
Block a user