Closes resources.
979784
@Override
  public void close() {

    if (closed.compareAndSet(false, true) && numThreads > 0) {

      LOG.log(Level.FINEST, "Closing ThreadPoolStage {0}: begin", this.name);

      executor.shutdown();

      boolean isTerminated = false;
      try {
        isTerminated = executor.awaitTermination(SHUTDOWN_TIMEOUT, TimeUnit.MILLISECONDS);
      } catch (final InterruptedException ex) {
        LOG.log(Level.WARNING, "Interrupted closing ThreadPoolStage " + this.name, ex);
      }

      if (!isTerminated) {
        final List<Runnable> droppedRunnables = executor.shutdownNow();
        LOG.log(Level.SEVERE,
            "Closing ThreadPoolStage {0}: Executor did not terminate in {1} ms. Dropping {2} tasks",
            new Object[] {this.name, SHUTDOWN_TIMEOUT, droppedRunnables.size()});
      }

      if (!executor.isTerminated()) {
        LOG.log(Level.SEVERE, "Closing ThreadPoolStage {0}: Executor failed to terminate.", this.name);
      }

      LOG.log(Level.FINEST, "Closing ThreadPoolStage {0}: end", this.name);
    }
  }
494605
public static void safeClose(final Closeable c) {
        if (c != null) {
            try {
                c.close();
            } catch (Exception e) {
                VFSLogger.ROOT_LOGGER.trace("Failed to close resource", e);
            }
        }
    }
559708
def close(self):
        ""
        if self.stream:
            self.stream.close(self.scheduler)
            self.stream = None
265332
def close(self):
        """"""
        if self.connection:
            self.connection.close()
            self.connection = None
            logging.debug("Connection closed.")
680735
@Override
    public void close() {
        closeComponent(this.containerManager);
        closeComponent(this.containerRegistry);
        closeComponent(this.dataLogFactory);
        closeComponent(this.readIndexFactory);
        closeComponent(this.cacheFactory);
        this.cacheManager.close();
        this.threadPoolMetrics.close();
        ExecutorServiceHelpers.shutdown(SHUTDOWN_TIMEOUT, this.storageExecutor, this.coreExecutor);
    }
1084748
public final void close()
    {
        try
        {
            if (!isClosed)
            {
                isRunning = false;
                isClosed = true;
                agent.onClose();
            }
        }
        catch (final Throwable throwable)
        {
            errorHandler.onError(throwable);
        }
    }
1223436
def close(self):
        
        files = self.__dict__.get('files')
        for key, value in iter_multi_items(files or ()):
            value.close()
740100
public function close()
    {
        if (!is_resource($this->socket)) {
            return;
        }

        fclose($this->socket);
        $this->socket = null;
    }
381937
def close(self):
        """"""
        assert self.closed is False

        if self.is_swo_running:
            self.stop_swo()
        self.closed = True
        self.rx_stop_event.set()
        self.read_sem.release()
        self.thread.join()
        assert self.rcv_data[-1] is None
        self.rcv_data = []
        self.swo_data = []
        usb.util.release_interface(self.dev, self.intf_number)
        usb.util.dispose_resources(self.dev)
        self.ep_out = None
        self.ep_in = None
        self.ep_swo = None
        self.dev = None
        self.intf_number = None
        self.thread = None
203960
def close(self):
        
        files = self.__dict__.get("files")
        for _key, value in iter_multi_items(files or ()):
            value.close()
557242
public void close() {

        if (this.xaConnection != null) {
            this.xaConnection.doClose();
        }
        this.closed = true;
        this.notifyClosed();

        if (LOG.isDebugEnabled()) {
            LOG.debug("PhynixxXAResource[" + this.getId() + "]:closed ");
        }
    }
1370055
protected void close() {
        guard.close();

        if (fd != null) {
            datagramSocketClose();
            ResourceManager.afterUdpClose();
            fd = null;
        }
    }
517040
public void close() {
        lock.lock();
        try {
            if (this.closed) {
                return;
            }

            if (!this.inited) {
                return;
            }

            if (logStatsThread != null) {
                logStatsThread.interrupt();
            }

            if (createConnectionThread != null) {
                createConnectionThread.interrupt();
            }

            if (destroyConnectionThread != null) {
                destroyConnectionThread.interrupt();
            }

            if (destroySchedulerFuture != null) {
                destroySchedulerFuture.cancel(true);
            }

            for (int i = 0; i < poolingCount; ++i) {
                try {
                    DruidConnectionHolder connHolder = connections[i];

                    for (PreparedStatementHolder stmtHolder : connHolder.getStatementPool().getMap().values()) {
                        connHolder.getStatementPool().closeRemovedStatement(stmtHolder);
                    }
                    connHolder.getStatementPool().getMap().clear();

                    Connection physicalConnection = connHolder.getConnection();
                    physicalConnection.close();
                    connections[i] = null;
                    destroyCount.incrementAndGet();
                } catch (Exception ex) {
                    LOG.warn("close connection error", ex);
                }
            }
            poolingCount = 0;

            // close elasticsearch client
            if (this.client != null) {
                this.client.close();
            }

            unregisterMbean();

            enable = false;
            notEmpty.signalAll();
            notEmptySignalCount++;

            this.closed = true;
            this.closeTimeMillis = System.currentTimeMillis();

            for (Filter filter : filters) {
                filter.destroy();
            }
        } finally {
            lock.unlock();
        }

        if (LOG.isInfoEnabled()) {
            LOG.info("{dataSource-" + this.getID() + "} closed");
        }
    }
206404
public void close() {
        Log.info("Closing index");
        try {
            Log.info("Closing");
            searcherReopener.interrupt();
            searcherManager.close();
            indexWriter.close();
            directory.close();
        } catch (IOException e) {
            Log.error(e, "Error while closing index");
            throw new RuntimeException(e);
        }
    }
831135
def close(self):
        """"""
        for handle in self._handles:
            if not handle.closed:
                handle.close()
        del self._handles[:]
        for transport, _ in self.connections:
            transport.close()
        self._all_closed.wait()
263110
public void close()
  {
    StreamSource ss = _indirectSource;
    _indirectSource = null;
    
    if (ss != null) {
      ss.freeUseCount();
    }
    else {
      freeUseCount();
    }
  }
435536
public void shutdown() throws IOException {
		if(shutdownDone) {
			return;
		}
		if(resourceStore != null) {
			resourceStore.shutdown();
		}
		if(resourceIndex != null) {
			resourceIndex.shutdown();
		}
		if(shutdownables != null) {
			for(Shutdownable s : shutdownables) {
				s.shutdown();
			}
		}
		shutdownDone = true;
	}