mirror of
https://github.com/BlueMap-Minecraft/BlueMap.git
synced 2024-11-23 02:55:19 +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
|
@Override
|
||||||
public void run(){
|
public synchronized void start() {
|
||||||
close();
|
close();
|
||||||
|
|
||||||
connectionThreads = new ThreadPoolExecutor(maxConnections, maxConnections, 10, TimeUnit.SECONDS, new LinkedBlockingQueue<>());
|
connectionThreads = new ThreadPoolExecutor(maxConnections, maxConnections, 10, TimeUnit.SECONDS, new LinkedBlockingQueue<>());
|
||||||
@ -73,6 +73,13 @@ public void run(){
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
super.start();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void run(){
|
||||||
|
if (server == null) return;
|
||||||
|
|
||||||
Logger.global.logInfo("WebServer started.");
|
Logger.global.logInfo("WebServer started.");
|
||||||
|
|
||||||
while (!server.isClosed() && server.isBound()){
|
while (!server.isClosed() && server.isBound()){
|
||||||
@ -98,7 +105,7 @@ public void run(){
|
|||||||
Logger.global.logInfo("WebServer closed.");
|
Logger.global.logInfo("WebServer closed.");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void close(){
|
public synchronized void close(){
|
||||||
if (connectionThreads != null) connectionThreads.shutdown();
|
if (connectionThreads != null) connectionThreads.shutdown();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
Loading…
Reference in New Issue
Block a user