mirror of
https://github.com/ME1312/SubServers-2.git
synced 2024-11-25 03:35:26 +01:00
Fix brief shutdown hang in SubServers.Client
This commit is contained in:
parent
ce262c62f0
commit
1521acfc51
@ -110,7 +110,7 @@ public class Executable {
|
||||
private static boolean terminate9(Object handle) {
|
||||
try { // Attempt iteration over Java 9 ProcessHandle objects
|
||||
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);
|
||||
children.forEach(Executable::terminate9);
|
||||
return false;
|
||||
|
@ -182,16 +182,6 @@ public class SubProtocol extends SubDataProtocol {
|
||||
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 {
|
||||
return open(getLogger(0), address, port);
|
||||
}
|
||||
|
@ -195,13 +195,6 @@ public class SubProtocol extends SubDataProtocol {
|
||||
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 {
|
||||
return open(getLogger(0), address, port);
|
||||
}
|
||||
|
@ -110,7 +110,7 @@ public class Executable {
|
||||
private static boolean terminate9(Object handle) {
|
||||
try { // Attempt iteration over Java 9 ProcessHandle objects
|
||||
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);
|
||||
children.forEach(Executable::terminate9);
|
||||
return false;
|
||||
|
Loading…
Reference in New Issue
Block a user