Fix threading for beacon

This commit is contained in:
crschnick 2024-06-16 22:16:41 +00:00
parent c2e3caa63d
commit be6ed54afd

View file

@ -116,8 +116,9 @@ public class AppBeaconServer {
BeaconInterface.getAll().forEach(beaconInterface -> { BeaconInterface.getAll().forEach(beaconInterface -> {
server.createContext(beaconInterface.getPath(), new BeaconRequestHandler<>(beaconInterface)); server.createContext(beaconInterface.getPath(), new BeaconRequestHandler<>(beaconInterface));
}); });
server.setExecutor(Executors.newSingleThreadExecutor(r -> { server.setExecutor(Executors.newFixedThreadPool(5, r -> {
Thread t = Executors.defaultThreadFactory().newThread(r); Thread t = Executors.defaultThreadFactory().newThread(r);
t.setDaemon(true);
t.setName("http handler"); t.setName("http handler");
t.setUncaughtExceptionHandler((t1, e) -> { t.setUncaughtExceptionHandler((t1, e) -> {
ErrorEvent.fromThrowable(e).handle(); ErrorEvent.fromThrowable(e).handle();