Stops the server.

@return True if the server was stopped, false if an error occurred or if the
server wasn't started.

@see #start()
@see #isRunning()
@see WindowManagerService#stopViewServer()
343713
public boolean stop() {
        if (mThread != null) {
            mThread.interrupt();
            if (mThreadPool != null) {

                try {
                    mThreadPool.shutdownNow();
                } catch (SecurityException e) {
                    Log.w(LOG_TAG, "Could not stop all view server threads");
                }
            }

            mThreadPool = null;
            mThread = null;

            try {
                mServer.close();
                mServer = null;
                return true;
            } catch (IOException e) {
                Log.w(LOG_TAG, "Could not close the view server");
            }
        }

        mWindowsLock.writeLock().lock();
        try {
            mWindows.clear();
        } finally {
            mWindowsLock.writeLock().unlock();
        }

        mFocusLock.writeLock().lock();
        try {
            mFocusedWindow = null;
        } finally {
            mFocusLock.writeLock().unlock();
        }

        return false;
    }
1301733
public void quit() {
        try {
            this.keepOn = false;
            if (this.serverSocket != null && !this.serverSocket.isClosed()) {
                this.serverSocket.close();
                this.serverSocket = null;
            }
        } catch (final IOException e) {
            throw new RuntimeException(e);
        }
    }
1075347
public void stopServer()
    {
        Log(Level.INFO, "Attempting to stop SocketServer");
        keepRunning = false;
        // Thread will be blocked waiting for input - unblock it by closing the socket underneath it:
        if (this.serverSocket != null)
        {
            try
            {
                this.serverSocket.close();
            }
            catch (IOException e)
            {
                Log(Level.WARNING, "Something happened when closing SocketServer: " + e);
            }
            this.serverSocket = null;
        }
    }
438648
public void stopServer() throws Exception {
        if (!externalDatabaseHost) {
            try (Connection sqlConnection = getConnection()) {
                sqlConnection.prepareStatement("SHUTDOWN").execute();
            } catch (Exception e) {
            }

            try {
                server.stop();
            } catch (Exception e) {
            }
        }
    }
911495
public void stop() {
    if (stopRequested) {
      return;
    }
    stopRequested = true;
    running = false;
    if (server != null) server.stop();
    if (triggerThread != null) {
      triggerThread.interrupt();
      triggerMonitor = null;
    }
    if (urfThread != null) {
      urfThread.interrupt();
      urfProcessor = null;
    }
    if (blockIntegrityMonitor != null) blockIntegrityMonitor.running = false;
    if (blockFixerThread != null) blockFixerThread.interrupt();
    if (blockCopierThread != null) blockCopierThread.interrupt();
    if (corruptFileCounterThread != null) corruptFileCounterThread.interrupt();
    if (purgeMonitor != null) purgeMonitor.running = false;
    if (purgeThread != null) purgeThread.interrupt();
    if (placementMonitor != null) placementMonitor.stop();
    if (statsCollector != null) statsCollector.stop();
    if (statsCollectorThread != null) statsCollectorThread.interrupt();
    if (infoServer != null) {
      try {
        infoServer.stop();
      } catch (Exception e) {
        LOG.warn("Exception shutting down " + RaidNode.class, e);
      }
    }
    this.unregisterMBean();
  }
384734
public boolean stop() {
        if (!this.isTailing.get()) {
            LogWatchTailingManager.LOGGER.debug("Tailer not running, therefore not terminating.");
            return false;
        }
        /*
         * terminate tailer; we stop the scheduler and the task will therefore
         * never be started again
         */
        this.tailer.stop();
        LogWatchTailingManager.LOGGER.info("Terminated tailing #{} for {}.",
                this.numberOfTimesThatTailerWasStarted.get(), this.watch);
        return true;
    }
393281
public void stopServer()
  {
    // _heartbeatState.notifyHeartbeatStop();

    SocketPool pool = _clusterSocketPool.get();
    
    if (pool != null) {
      pool.getFactory().notifyHeartbeatStop();
    }
  }
886636
public synchronized void stop() throws Exception {
        if (!running) {
            return;
        }

        for (Connector each : this.connectors) {
            try {
                each.stop();
                each.setServer( null );
            } catch (Exception e) {
                // ignore
            }
        }

        running = false;
    }
686303
@Override
    public void stop() {
        String command = "sudo service apache2 stop";
        newScript(STOPPING)
                .body.append(command).execute();
    }
268029
@Override
	public void stop()
    {
        super.stop();
        if (connectorServer != null)
        {
            try
            {
                connectorServer.stop();
            }
            catch (Exception e)
            {
                log.error("Could not stop JMX connector server",e);
            }
            finally
            {
            	connectorServer = null;
            }
        }
        if (registry != null)
        {
	        try
	        {
	        	String jndiName = "jmxconnector-"+agentName;
	            registry.unbind(jndiName);
	        }
	        catch (Exception e)
	        {
	        	// Ignore
	        }
	        finally
	        {
	        	registry = null;
	        }
        }
        if (mBeanServerSocketFactory != null)
        {
        	try
            {
        		mBeanServerSocketFactory.close();
            }
        	catch (Exception e)
            {
                log.error("Could not close MBeans server socket factory",e);
            }
        	finally
            {
        		mBeanServerSocketFactory = null;
            }
        }
    }
729279
public JettyBootstrap stopServer() throws JettyBootstrapException {
        LOG.info("Stopping Server...");
        try {
            if (isServerStarted()) {
                handlers.stop();

                server.stop();

                LOG.info("Server stopped.");
            } else {
                LOG.warn("Can't stop server. Already stopped");
            }
        } catch (Exception e) {
            throw new JettyBootstrapException(e);
        }

        return this;
    }
1368801
public boolean stopStandby() {
    for (int k = 0; k < mNumOfMasters; k++) {
      if (!mMasters.get(k).isServing()) {
        try {
          LOG.info("master {} is a standby. stopping it...", k);
          mMasters.get(k).stop();
          LOG.info("master {} stopped.", k);
        } catch (Exception e) {
          LOG.error(e.getMessage(), e);
          return false;
        }
        return true;
      }
    }
    return false;
  }
1351180
@Override
  public void stop() throws IOException {
    if (jettyServer != null) {
      try {
        jettyServer.stop();
      } catch (IOException e) {
        throw e;
      } catch (Exception e) {
        throw new IOException(e);
      }
    }
  }
1037291
@Override
  public void shutdown() {
    LOG.info("Shutting down ...");
    shouldShutdown = true;
    if (tserver != null) {
      tserver.stop();
    }
    started = false;
  }
1369481
@Override
	public synchronized boolean shutdown()
    {
    	if (!started)
    		return false;
    	
    	try
    	{
	        log.info("Server shutting down ...");
	        
	        // Undeploy bridges
	        undeployBridges();
	        
	        // Stop the tcp listener
	        if (tcpListener != null)
	        {
	        	tcpListener.stop();
	        	tcpListener = null;
	        }
	        
	        // Terminate the admin thread
	        if (adminThread != null)
	        {
	            adminThread.pleaseStop();
	            try
	            {
	                adminThread.join(ADMIN_THREAD_STOP_TIMEOUT*1000);
	                adminThread = null;
	            }
	            catch (InterruptedException e)
	            {
	                log.warn("Shutdown was interrupted while waiting for the admin thread to stop");
	            }
	        }
	        
	        // Undeploy engine
	        engine.undeploy();
	        try
	    	{
	    		if (jmxAgent != null)
	    			jmxAgent.unregister(new ObjectName(JMXAgent.JMX_DOMAIN+":type=Engines,engine="+engine.getName()));
	    	}
	    	catch (Exception e)
	    	{
	    		log.error("Cannot unregister local engine from JMX agent",e);
	    	}
	        
	        // Undeploy JMX
	        if (jmxAgent != null)
	        	jmxAgent.stop();
	        
	        started = false;
	        	        
	        log.info("Shutdown complete.");
	        
	        return true;
    	}
    	catch (Exception e)
    	{
    		log.error("Server shutdown failed",e);
    		return false;
    	}
    }
114503
public void stop() throws InterruptedException {
		if (!isStarted.get()) {
			throw new IllegalStateException("The StreamServer is not started");
		}
		stopServer();
		stopClients();
		closeSocket();
		try {
			waitForServerToTerminate();
			isStarted.set(false);
			stopServer();
		} catch (InterruptedException e) {
			logger.error("InterruptedException while waiting for termination", e);
			throw e;
		}
	}
179503
@Override
    public synchronized void stop() {
        Preconditions.checkNotNull(getServer());
        if (getServer().isRunning()) {
            try {
                log.info("Stopping...");
                getServer().stop();
                log.info("STOPPED.");
            } catch (Exception e) {
                Throwable t = Throwables.getRootCause(e);
                log.error("Fathom failed on shutdown!", t);
            }
        }
    }