Java Code Examples for io.fabric8.kubernetes.client.utils.Utils#shutdownExecutorService()

The following examples show how to use io.fabric8.kubernetes.client.utils.Utils#shutdownExecutorService() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: KubernetesClientFactory.java    From che with Eclipse Public License 2.0 6 votes vote down vote up
/**
 * Shuts down the {@link KubernetesClient} by closing its connection pool. Typically should be
 * called on application tear down.
 */
public void shutdownClient() {
  ConnectionPool connectionPool = httpClient.connectionPool();
  Dispatcher dispatcher = httpClient.dispatcher();
  ExecutorService executorService =
      httpClient.dispatcher() != null ? httpClient.dispatcher().executorService() : null;

  if (dispatcher != null) {
    dispatcher.cancelAll();
  }

  if (connectionPool != null) {
    connectionPool.evictAll();
  }

  Utils.shutdownExecutorService(executorService);
}
 
Example 2
Source File: BaseClient.java    From kubernetes-client with Apache License 2.0 6 votes vote down vote up
@Override
public void close() {
  ConnectionPool connectionPool = httpClient.connectionPool();
  Dispatcher dispatcher = httpClient.dispatcher();
  ExecutorService executorService = httpClient.dispatcher() != null ? httpClient.dispatcher().executorService() : null;

  if (dispatcher != null) {
    dispatcher.cancelAll();
  }

  if (connectionPool != null) {
    connectionPool.evictAll();
  }

  Utils.shutdownExecutorService(executorService);
}