Shuts the {@link TaskExecutor} services down.
339918
public void shutDown() throws FlinkException {

		Exception exception = null;

		try {
			taskManagerStateStore.shutdown();
		} catch (Exception e) {
			exception = e;
		}

		try {
			memoryManager.shutdown();
		} catch (Exception e) {
			exception = ExceptionUtils.firstOrSuppressed(e, exception);
		}

		try {
			ioManager.shutdown();
		} catch (Exception e) {
			exception = ExceptionUtils.firstOrSuppressed(e, exception);
		}

		try {
			networkEnvironment.shutdown();
		} catch (Exception e) {
			exception = ExceptionUtils.firstOrSuppressed(e, exception);
		}

		try {
			kvStateService.shutdown();
		} catch (Exception e) {
			exception = ExceptionUtils.firstOrSuppressed(e, exception);
		}

		try {
			taskSlotTable.stop();
		} catch (Exception e) {
			exception = ExceptionUtils.firstOrSuppressed(e, exception);
		}

		try {
			jobLeaderService.stop();
		} catch (Exception e) {
			exception = ExceptionUtils.firstOrSuppressed(e, exception);
		}

		taskEventDispatcher.clearAll();

		if (exception != null) {
			throw new FlinkException("Could not properly shut down the TaskManager services.", exception);
		}
	}
1154979
public final void close () throws IOException {

        LOGGER.info("Closing was requested.");

        for (Connection c : connections) {
            c.close();
        }

        connections.clear();

        // stop session task thread
        factory.closedSession(this);
        executor.shutdown();
    }
1002717
def shutdown(self):
        

        if not self._exited:
            self._exited = True
            _shutdown_pipe(self._pipe)
            self._task.stop()
            raise SystemExit
1225044
public void cancel() {
        if(actionInBackground != null) {
            if(executorService != null) {
               asyncFutureTask.cancel(true);
            } else {
                asyncThread.interrupt();
            }
        }
    }
1191079
public static void shutdown() {
        try {
            EXECUTOR_SERVICE.shutdown();

            if (RuntimeCache.REDIS == getRuntimeCache()) {
                RedisCache.shutdown();
            }

            Connections.shutdownConnectionPool();
            if (RuntimeDatabase.H2 == getRuntimeDatabase()) {
                final String newTCPServer = getLocalProperty("newTCPServer");
                if ("true".equals(newTCPServer)) {
                    h2.stop();
                    h2.shutdown();

                    LOGGER.log(Level.INFO, "Closed H2 TCP server");
                }
            }
        } catch (final Exception e) {
            LOGGER.log(Level.ERROR, "Shutdowns Latke failed", e);
        }

        BeanManager.close();

        // Manually unregister JDBC driver, which prevents Tomcat from complaining about memory leaks
        final Enumeration<Driver> drivers = DriverManager.getDrivers();
        while (drivers.hasMoreElements()) {
            final Driver driver = drivers.nextElement();

            try {
                DriverManager.deregisterDriver(driver);
                LOGGER.log(Level.TRACE, "Unregistered JDBC driver [" + driver + "]");
            } catch (final SQLException e) {
                LOGGER.log(Level.ERROR, "Unregister JDBC driver [" + driver + "] failed", e);
            }
        }
    }
882920
@Override
  public void close() {
    executor.shutdown();
    scheduler.shutdown();
    client.close();
    closeFuture.complete(null);
  }
1362363
public void stop() {
        if (!this.isActive) {
            return;
        }

        coreThread.shutdown();
        criticalThread.shutdown();
        for(int i=0;i<workerThreads.length;i++)
        	workerThreads[i].shutdown();
        
        for(int i=0;i<criticalWorkerThreads.length;i++)
        	criticalWorkerThreads[i].shutdown();
        
        try
        {
        	Thread.sleep(40);
        }
        catch(InterruptedException e)
		{                				
		}
        
        for(int i=0;i<taskQueues.length;i++)
        	taskQueues[i].clear();
        
        for(int i=0;i<heartBeatQueue.length;i++)
        	heartBeatQueue[i].clear();
    }
580959
@Override
    public void close() {
        try {
            // Prevent new tasks being submitted
            shutdown();
        } catch (final SecurityException e) {
            // Ignore for now (caught again if shutdownNow() fails)
        }
        boolean terminated = false;
        try {
            // Await termination of any running tasks
            terminated = awaitTermination(2500, TimeUnit.MILLISECONDS);
        } catch (final InterruptedException e) {
            interruptionChecker.interrupt();
        }
        if (!terminated) {
            try {
                // Interrupt all the threads to terminate them, if awaitTermination() timed out
                shutdownNow();
            } catch (final SecurityException e) {
                throw ClassGraphException.newClassGraphException("Could not shut down ExecutorService -- need "
                        + "java.lang.RuntimePermission(\"modifyThread\"), "
                        + "or the security manager's checkAccess method denies access", e);
            }
        }
    }
1045866
@Override
  protected void shutDown() throws Exception {
    this.scheduledExecutor.shutdown();
    this.scheduledExecutor.awaitTermination(TERMINATION_TIMEOUT, TimeUnit.SECONDS);
  }
1000298
public void shutdown() {
        try {
            executorService.shutdown();
            executorService.awaitTermination(10, TimeUnit.SECONDS);
        } catch (Throwable e) {
            log.error("Interrupted during shutdown.", e);
        }
    }
571992
public static synchronized void shutDown() {
    if (sInstance != null) {
      sInstance.getBitmapMemoryCache().removeAll(AndroidPredicates.<CacheKey>True());
      sInstance.getEncodedMemoryCache().removeAll(AndroidPredicates.<CacheKey>True());
      sInstance = null;
    }
  }
921259
private void destroyPingExecutor() {
        synchronized (pingExecutor) {
            if (!pingExecutor.isShutdown()) {
                try {
                    log.debugf("Shutting down WebSocket ping executor");
                    pingExecutor.shutdown();
                    if (!pingExecutor.awaitTermination(1, TimeUnit.SECONDS)) {
                        pingExecutor.shutdownNow();
                    }
                } catch (Throwable t) {
                    log.warnf("Cannot shut down WebSocket ping executor. Cause=%s", t.toString());
                }
            }
        }
    }
1342298
public static boolean shutdownExecutorService(ExecutorService executorService) {
    if (executorService == null) {
      return false;
    }
    //If it hasn't already shutdown, do shutdown.
    if (!executorService.isShutdown()) {
      executorService.shutdown();
    }

    try {
      //Wait for clean termination
      if (executorService.awaitTermination(5, TimeUnit.SECONDS)) {
        return true;
      }

      //If not already terminated (via shutdownNow) do shutdownNow.
      if (!executorService.isTerminated()) {
        executorService.shutdownNow();
      }

      if (executorService.awaitTermination(5, TimeUnit.SECONDS)) {
        return true;
      }

      if (LOGGER.isDebugEnabled()) {
        List<Runnable> tasks = executorService.shutdownNow();
        if (!tasks.isEmpty()) {
          LOGGER.debug("ExecutorService was not cleanly shutdown, after waiting for 10 seconds. Number of remaining tasks:" + tasks.size());
        }
      }
    } catch (InterruptedException e) {
      executorService.shutdownNow();
      //Preserve interrupted status
      Thread.currentThread().interrupt();
    }
    return false;
  }
1328966
public void shutdown() {

		if (!this.shutdownStarted.compareAndSet(false, true)) {
			return;
		}

		LOG.info("Shutting down TaskManager");
		
		// first, stop the heartbeat thread and wait for it to terminate
		this.heartbeatThread.interrupt();
		try {
			this.heartbeatThread.join(1000);
		} catch (InterruptedException e) {}

		// Stop RPC proxy for the task manager
		RPC.stopProxy(this.jobManager);

		// Stop RPC proxy for the global input split assigner
		RPC.stopProxy(this.globalInputSplitProvider);

		// Stop RPC proxy for the lookup service
		RPC.stopProxy(this.lookupService);

		// Stop RPC proxy for accumulator reports
		RPC.stopProxy(this.accumulatorProtocolProxy);

		// Shut down the own RPC server
		this.taskManagerServer.stop();

		// Stop profiling if enabled
		if (this.profiler != null) {
			this.profiler.shutdown();
		}

		// Shut down the network channel manager
		this.channelManager.shutdown();

		// Shut down the memory manager
		if (this.ioManager != null) {
			this.ioManager.shutdown();
		}

		if (this.memoryManager != null) {
			this.memoryManager.shutdown();
		}

		this.fileCache.shutdown();

		// Shut down the executor service
		if (this.executorService != null) {
			this.executorService.shutdown();
			try {
				this.executorService.awaitTermination(5000L, TimeUnit.MILLISECONDS);
			} catch (InterruptedException e) {
				if (LOG.isDebugEnabled()) {
					LOG.debug(e);
				}
			}
		}

		this.shutdownComplete = true;
	}
998893
public static void shutdown() {
		UdpResources resources = udpResources.getAndSet(null);
		if (resources != null) {
			resources._dispose();
		}
	}
704354
public void shutdown() {
        final int taskCount = runningTasks.size();
        for (int i = 0; i < taskCount; ++i) {
            int key = runningTasks.keyAt(i);
            LoadBitmapTask t = runningTasks.get(key);
            t.cancel(true);
        }
        runningTasks.clear();
    }
417055
void shutdownAndAwaitTermination(ExecutorService pool) {
        pool.shutdownNow(); // Disable new tasks from being submitted
        try {
            logger.debug("Waiting up to 30 seconds for ExecutorService to shut down");
            // Wait a while for existing tasks to terminate
            if (!pool.awaitTermination(30, TimeUnit.SECONDS)) {
                logger.debug("Pool did not terminate");
            }
        } catch (InterruptedException ie) {
            // (Re-)Cancel if current thread also interrupted
            pool.shutdownNow();
            // Preserve interrupt status
            Thread.currentThread().interrupt();
        }
    }