Call Jetty#destroy when shutting down webserver

Affects issues:
- Possibly fixed #2518
This commit is contained in:
Aurora Lahtela 2022-08-01 18:28:19 +03:00
parent 053fe2528b
commit fa6c7232a9

View File

@ -69,6 +69,7 @@ public class JettyWebserver implements WebServer {
} }
webserver = new Server(); webserver = new Server();
webserver.setStopAtShutdown(true);
this.port = webserverConfiguration.getPort(); this.port = webserverConfiguration.getPort();
@ -193,7 +194,12 @@ public class JettyWebserver implements WebServer {
@Override @Override
public void disable() { public void disable() {
try { try {
if (webserver != null) webserver.stop(); if (webserver != null) {
webserver.stop();
webserver.destroy();
}
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
} catch (Exception e) { } catch (Exception e) {
throw new IllegalStateException(e); throw new IllegalStateException(e);
} }