mirror of
https://github.com/BlueMap-Minecraft/BlueMap.git
synced 2024-11-22 10:35:16 +01:00
Create the webserver-connection syncronized
to make sure it is fully started before it can get closed again. Fixes #89
This commit is contained in:
parent
3b6ed4c297
commit
b8cd92b507
@ -59,7 +59,7 @@ public WebServer(int port, int maxConnections, InetAddress bindAdress, HttpReque
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run(){
|
||||
public synchronized void start() {
|
||||
close();
|
||||
|
||||
connectionThreads = new ThreadPoolExecutor(maxConnections, maxConnections, 10, TimeUnit.SECONDS, new LinkedBlockingQueue<>());
|
||||
@ -73,6 +73,13 @@ public void run(){
|
||||
return;
|
||||
}
|
||||
|
||||
super.start();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run(){
|
||||
if (server == null) return;
|
||||
|
||||
Logger.global.logInfo("WebServer started.");
|
||||
|
||||
while (!server.isClosed() && server.isBound()){
|
||||
@ -98,7 +105,7 @@ public void run(){
|
||||
Logger.global.logInfo("WebServer closed.");
|
||||
}
|
||||
|
||||
public void close(){
|
||||
public synchronized void close(){
|
||||
if (connectionThreads != null) connectionThreads.shutdown();
|
||||
|
||||
try {
|
||||
|
Loading…
Reference in New Issue
Block a user