Source:
<code>public synchronized void stop(final String reason) { <START> if ( isRunning ) <END> { return; } isRunning = true; new Thread( "Shutdown Thread" ) { @Override @SuppressFBWarnings("DM_EXIT") @SuppressWarnings("TooBroadCatch") public void run() { stopListeners(); getLogger().info( "Closing pending connections" ); connectionLock.readLock().lock(); try { getLogger().log( Level.INFO, "Disconnecting {0} connections", connections.size() ); for ( UserConnection user : connections.values() ) { user.disconnect( reason ); } } finally { connectionLock.readLock().unlock(); } try { Thread.sleep( 500 ); } catch ( InterruptedException ex ) { } if ( reconnectHandler != null ) { getLogger().info( "Saving reconnect locations" ); reconnectHandler.save(); reconnectHandler.close(); } saveThread.cancel(); metricsThread.cancel(); getLogger().info( "Disabling plugins" ); for ( Plugin plugin : Lists.reverse( new ArrayList<>( pluginManager.getPlugins() ) ) ) { try { plugin.onDisable(); for ( Handler handler : plugin.getLogger().getHandlers() ) { handler.close(); } } catch ( Throwable t ) { getLogger().log( Level.SEVERE, "Exception disabling plugin " + plugin.getDescription().getName(), t ); } getScheduler().cancel( plugin ); plugin.getExecutorService().shutdownNow(); } getLogger().info( "Closing IO threads" ); eventLoops.shutdownGracefully(); try { eventLoops.awaitTermination( Long.MAX_VALUE, TimeUnit.NANOSECONDS ); } catch ( InterruptedException ex ) { } getLogger().info( "Thank you and goodbye" ); for ( Handler handler : getLogger().getHandlers() ) { handler.close(); } System.exit( 0 ); } }.start(); }</code><technical_language>want check this</technical_language>

Target:
public synchronized void stop(final String reason) { if ( !isRunning ) { return; } isRunning = false; new Thread( "Shutdown Thread" ) { @Override @SuppressFBWarnings("DM_EXIT") @SuppressWarnings("TooBroadCatch") public void run() { stopListeners(); getLogger().info( "Closing pending connections" ); connectionLock.readLock().lock(); try { getLogger().log( Level.INFO, "Disconnecting {0} connections", connections.size() ); for ( UserConnection user : connections.values() ) { user.disconnect( reason ); } } finally { connectionLock.readLock().unlock(); } try { Thread.sleep( 500 ); } catch ( InterruptedException ex ) { } if ( reconnectHandler != null ) { getLogger().info( "Saving reconnect locations" ); reconnectHandler.save(); reconnectHandler.close(); } saveThread.cancel(); metricsThread.cancel(); getLogger().info( "Disabling plugins" ); for ( Plugin plugin : Lists.reverse( new ArrayList<>( pluginManager.getPlugins() ) ) ) { try { plugin.onDisable(); for ( Handler handler : plugin.getLogger().getHandlers() ) { handler.close(); } } catch ( Throwable t ) { getLogger().log( Level.SEVERE, "Exception disabling plugin " + plugin.getDescription().getName(), t ); } getScheduler().cancel( plugin ); plugin.getExecutorService().shutdownNow(); } getLogger().info( "Closing IO threads" ); eventLoops.shutdownGracefully(); try { eventLoops.awaitTermination( Long.MAX_VALUE, TimeUnit.NANOSECONDS ); } catch ( InterruptedException ex ) { } getLogger().info( "Thank you and goodbye" ); for ( Handler handler : getLogger().getHandlers() ) { handler.close(); } System.exit( 0 ); } }.start(); }