Wait for thread executors to shut down

This commit is contained in:
KingRainbow44
2023-06-01 18:17:48 -04:00
parent 9dd514a73b
commit 8692405363
5 changed files with 75 additions and 35 deletions

View File

@@ -504,9 +504,7 @@ public final class Utils {
* @return A list of all fields in the class.
*/
public static List<Field> getAllFields(Class<?> type) {
var fields = new LinkedList<>(
Arrays.asList(type.getDeclaredFields())
);
var fields = new LinkedList<>(Arrays.asList(type.getDeclaredFields()));
// Check for superclasses.
if (type.getSuperclass() != null) {
@@ -515,4 +513,16 @@ public final class Utils {
return fields;
}
/**
* Sleeps the current thread without an exception.
*
* @param millis The amount of milliseconds to sleep.
*/
public static void sleep(long millis) {
try {
Thread.sleep(millis);
} catch (InterruptedException ignored) {
}
}
}