mirror of
https://github.com/Xiao-MoMi/Custom-Nameplates.git
synced 2025-12-22 00:23:48 +00:00
shut down scheduler on disable
This commit is contained in:
@@ -81,28 +81,12 @@ public abstract class AbstractJavaScheduler<T> implements SchedulerAdapter<T> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void shutdownScheduler() {
|
public void shutdownScheduler() {
|
||||||
this.scheduler.shutdown();
|
this.scheduler.shutdownNow();
|
||||||
try {
|
|
||||||
if (!this.scheduler.awaitTermination(1, TimeUnit.MINUTES)) {
|
|
||||||
this.plugin.getPluginLogger().severe("Timed out waiting for the CustomNameplates scheduler to terminate");
|
|
||||||
reportRunningTasks(thread -> thread.getName().equals("nameplates-scheduler"));
|
|
||||||
}
|
|
||||||
} catch (InterruptedException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void shutdownExecutor() {
|
public void shutdownExecutor() {
|
||||||
this.worker.shutdown();
|
this.worker.shutdownNow();
|
||||||
try {
|
|
||||||
if (!this.worker.awaitTermination(1, TimeUnit.MINUTES)) {
|
|
||||||
this.plugin.getPluginLogger().severe("Timed out waiting for the CustomNameplates worker thread pool to terminate");
|
|
||||||
reportRunningTasks(thread -> thread.getName().startsWith("nameplates-worker-"));
|
|
||||||
}
|
|
||||||
} catch (InterruptedException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void reportRunningTasks(Predicate<Thread> predicate) {
|
private void reportRunningTasks(Predicate<Thread> predicate) {
|
||||||
|
|||||||
@@ -310,7 +310,6 @@ public class BukkitCustomNameplates extends CustomNameplates implements Listener
|
|||||||
this.scheduledMainTask = getScheduler().asyncRepeating(mainTask, 50, 50, TimeUnit.MILLISECONDS);
|
this.scheduledMainTask = getScheduler().asyncRepeating(mainTask, 50, 50, TimeUnit.MILLISECONDS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public InputStream getResourceStream(String filePath) {
|
public InputStream getResourceStream(String filePath) {
|
||||||
return getBootstrap().getResource(filePath.replace("\\", "/"));
|
return getBootstrap().getResource(filePath.replace("\\", "/"));
|
||||||
|
|||||||
Reference in New Issue
Block a user