#2449: Avoid stopping if already in progress

Currently it is possible to stop the proxy multiple times, causing
the shutdown routines to be called twice. This doesn't make any
sense and may even cause problems with some plugins.

Cancel early if stopping is already in progress to avoid this.
This commit is contained in:
Minecrell 2018-07-09 01:57:21 +02:00 committed by md-5
parent ff42394bdb
commit 7410ce9077

View File

@ -379,8 +379,14 @@ public class BungeeCord extends ProxyServer
}
@Override
public void stop(final String reason)
public synchronized void stop(final String reason)
{
if ( !isRunning )
{
return;
}
isRunning = false;
new Thread( "Shutdown Thread" )
{
@Override
@ -388,8 +394,6 @@ public class BungeeCord extends ProxyServer
@SuppressWarnings("TooBroadCatch")
public void run()
{
BungeeCord.this.isRunning = false;
stopListeners();
getLogger().info( "Closing pending connections" );