Fix brief shutdown hang in SubServers.Client

This commit is contained in:
ME1312 2022-04-12 07:59:33 -04:00
parent ce262c62f0
commit 1521acfc51
No known key found for this signature in database
GPG Key ID: FEFFE2F698E88FA8
4 changed files with 2 additions and 19 deletions

View File

@ -110,7 +110,7 @@ public class Executable {
private static boolean terminate9(Object handle) { private static boolean terminate9(Object handle) {
try { // Attempt iteration over Java 9 ProcessHandle objects try { // Attempt iteration over Java 9 ProcessHandle objects
Class<?> clazz = handle.getClass(); Class<?> clazz = handle.getClass();
Stream<?> children = (Stream<?>) clazz.getMethod("descendants").invoke(handle); Stream<?> children = (Stream<?>) clazz.getMethod("children").invoke(handle);
clazz.getMethod("destroyForcibly").invoke(handle); clazz.getMethod("destroyForcibly").invoke(handle);
children.forEach(Executable::terminate9); children.forEach(Executable::terminate9);
return false; return false;

View File

@ -182,16 +182,6 @@ public class SubProtocol extends SubDataProtocol {
return subdata; return subdata;
} }
@SuppressWarnings("deprecation")
@Override
public SubDataClient open(Logger logger, InetAddress address, int port) throws IOException {
SubPlugin plugin = SubAPI.getInstance().getInternals();
return open(event -> {
if (plugin.isEnabled()) Bukkit.getScheduler().runTaskAsynchronously(plugin, event);
else event.run();
}, logger, address, port);
}
public SubDataClient open(InetAddress address, int port) throws IOException { public SubDataClient open(InetAddress address, int port) throws IOException {
return open(getLogger(0), address, port); return open(getLogger(0), address, port);
} }

View File

@ -195,13 +195,6 @@ public class SubProtocol extends SubDataProtocol {
return subdata; return subdata;
} }
@SuppressWarnings("deprecation")
@Override
public SubDataClient open(Logger logger, InetAddress address, int port) throws IOException {
SubPlugin plugin = SubAPI.getInstance().getInternals();
return open(event -> Sponge.getScheduler().createTaskBuilder().async().execute(event).submit(plugin), logger, address, port);
}
public SubDataClient open(InetAddress address, int port) throws IOException { public SubDataClient open(InetAddress address, int port) throws IOException {
return open(getLogger(0), address, port); return open(getLogger(0), address, port);
} }

View File

@ -110,7 +110,7 @@ public class Executable {
private static boolean terminate9(Object handle) { private static boolean terminate9(Object handle) {
try { // Attempt iteration over Java 9 ProcessHandle objects try { // Attempt iteration over Java 9 ProcessHandle objects
Class<?> clazz = handle.getClass(); Class<?> clazz = handle.getClass();
Stream<?> children = (Stream<?>) clazz.getMethod("descendants").invoke(handle); Stream<?> children = (Stream<?>) clazz.getMethod("children").invoke(handle);
clazz.getMethod("destroyForcibly").invoke(handle); clazz.getMethod("destroyForcibly").invoke(handle);
children.forEach(Executable::terminate9); children.forEach(Executable::terminate9);
return false; return false;