mirror of
https://gitlab.bixilon.de/bixilon/minosoft.git
synced 2025-09-10 07:48:29 -04:00
ExecutorService: print exception, if occurs
This commit is contained in:
parent
dea4f5253b
commit
ef967b19bc
@ -29,10 +29,7 @@ import java.security.NoSuchAlgorithmException;
|
|||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
import java.util.concurrent.Callable;
|
import java.util.concurrent.*;
|
||||||
import java.util.concurrent.ExecutorService;
|
|
||||||
import java.util.concurrent.Executors;
|
|
||||||
import java.util.concurrent.ThreadFactory;
|
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
import java.util.zip.*;
|
import java.util.zip.*;
|
||||||
|
|
||||||
@ -226,7 +223,13 @@ public final class Util {
|
|||||||
|
|
||||||
public static <T> void executeInThreadPool(String name, Collection<Callable<T>> callables) throws InterruptedException {
|
public static <T> void executeInThreadPool(String name, Collection<Callable<T>> callables) throws InterruptedException {
|
||||||
ExecutorService phaseLoader = Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors(), getThreadFactory(name));
|
ExecutorService phaseLoader = Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors(), getThreadFactory(name));
|
||||||
phaseLoader.invokeAll(callables);
|
phaseLoader.invokeAll(callables).forEach((tFuture -> {
|
||||||
|
try {
|
||||||
|
tFuture.get();
|
||||||
|
} catch (ExecutionException | InterruptedException ex) {
|
||||||
|
ex.getCause().printStackTrace();
|
||||||
|
}
|
||||||
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ThreadFactory getThreadFactory(String threadName) {
|
public static ThreadFactory getThreadFactory(String threadName) {
|
||||||
|
1
util/mcdata
Symbolic link
1
util/mcdata
Symbolic link
@ -0,0 +1 @@
|
|||||||
|
../data/mcdata/
|
Loading…
x
Reference in New Issue
Block a user