Closes the given {@link ZooKeeper} if it is not null. If there is InterruptedException,
it will get logged.
347881
private void closeZooKeeper(@Nullable ZooKeeper zk) {
    try {
      if (zk != null) {
        zk.close();
      }
    } catch (InterruptedException e) {
      LOG.warn("Interrupted when closing ZooKeeper", e);
      Thread.currentThread().interrupt();
    }
  }
1300271
def close(self, kill_restart=True):
        '''
        
        '''
        self.do_not_restart = kill_restart
        self.zoo_client.stop()
        self.zoo_client.close()
462862
@Override
    public void close() {
        if (!this.closed.getAndSet(true)) {
            this.metricReporter.cancel(true);
            this.metrics.close();
            this.rolloverProcessor.close();
            this.writeProcessor.close();

            // Close active ledger.
            WriteLedger writeLedger;
            synchronized (this.lock) {
                writeLedger = this.writeLedger;
                this.writeLedger = null;
                this.logMetadata = null;
            }

            // Close the write queue and cancel the pending writes.
            this.writes.close().forEach(w -> w.fail(new CancellationException("BookKeeperLog has been closed."), true));

            if (writeLedger != null) {
                try {
                    Ledgers.close(writeLedger.ledger);
                } catch (DurableDataLogException bkEx) {
                    log.error("{}: Unable to close LedgerHandle for Ledger {}.", this.traceObjectId, writeLedger.ledger.getId(), bkEx);
                }
            }

            log.info("{}: Closed.", this.traceObjectId);
        }
    }
849922
public synchronized void shutdown() {
        if (zoo == null)
            return;

        for (int e = 0; e < zoo.length; e++) {
            if (zoo[e] == null)
                continue;

            zoo[e].interrupt();
            zoo[e].shutdown();
            zoo[e] = null;
        }
        zoo = null;

        System.gc();
    }
660482
@Override
  public void close() throws Exception {
    if (closed.compareAndSet(false, true)) {
      interrupted.set(true);
      thread.interrupt();
    }
  }
682176
public void close() {
    /**
     * Set closed flag and notify all threads to check their conditions.
     * Should result in dispatcher terminating.
     */
    synchronized (buffer) {
      closed = true;
      buffer.notifyAll();
    }

    try {
      dispatcher.join();
    } catch (InterruptedException e) {
      Thread.currentThread().interrupt();
      org.apache.log4j.helpers.LogLog.error(
        "Got an InterruptedException while waiting for the "
        + "dispatcher to finish.", e);
    }

    //
    //    close all attached appenders.
    //
    appenders.closeAppenders();
  }
1145934
@Override
    public void close() throws IOException {
        try {
            if (reference != null) {
                closer.close(reference);
            }
        } catch (Exception e) {
            throw new IOException(e);
        } finally {
            this.wasClosed = true;
        }
    }
665563
protected final void close() {
		if (SwingUtilities.isEventDispatchThread()) {
			closeIntern();
		} else {
			try {
				SwingUtilities.invokeAndWait(new Runnable() {
					public void run() {
						closeIntern();
					}
				});
			} catch (final Exception ex) {
				ignore();
			}
		}
	}
715296
public void close() throws IOException, InterruptedException {
        channel.close();
        channel.join();
        if (ownsPool)
            pool.shutdown();
        for (Closeable c : closables)
            c.close();
    }
510457
@Override
  public synchronized void close() {
    if (endHandler != null) {
      endHandler.handle(null);
    }
    closed = true;
    if (listener != null && handleCalled) {
      listener.sessionClosed();
    }
  }
233494
public void close() {
    try {
      if (conn != null) {
        conn.close();
      }
    } catch (IOException ignored) { }

    if (zkClient != null) {
      zkClient.stopAndWait();
    }
  }
1342138
@Override
  public void close()
      throws IOException {
    if (delegateReader != null) {
      logger.atWarning().log(
          "Got non-null delegateReader during close(); possible premature close() call.");
      delegateReader.close();
      delegateReader = null;
    }
  }
162784
public void close() {
        try {
            synchronized (lock) {
                if (out == null)
                    return;
                out.close();
                out = null;
            }
        }
        catch (IOException x) {
            trouble = true;
        }
    }
712551
@Override
  public void close() throws IOException {
    if (open.compareAndSet(true, false)) {
      onClose.run();

      Throwable thrown = null;
      do {
        for (Closeable resource : resources) {
          try {
            resource.close();
          } catch (Throwable e) {
            if (thrown == null) {
              thrown = e;
            } else {
              thrown.addSuppressed(e);
            }
          } finally {
            // ensure the resource is removed even if it doesn't remove itself when closed
            resources.remove(resource);
          }
        }

        // It's possible for a thread registering a resource to register that resource after open
        // has been set to false and even after we've looped through and closed all the resources.
        // Since registering must be incremented *before* checking the state of open, however,
        // when we reach this point in that situation either the register call is still in progress
        // (registering > 0) or the new resource has been successfully added (resources not empty).
        // In either case, we just need to repeat the loop until there are no more register calls
        // in progress (no new calls can start and no resources left to close.
      } while (registering.get() > 0 || !resources.isEmpty());
      Throwables.propagateIfPossible(thrown, IOException.class);
    }
  }
159308
synchronized void close() {
    if (this.remoteManager.isPresent()) {
      try {
        this.remoteManager.get().close();
      } catch (final Exception e) {
        LOG.log(Level.WARNING, "Exception while shutting down the RemoteManager.", e);
      }
    }
  }
1136536
public void close() throws KNXMLException
	{
		if (closeReader)
			try {
				r.close();
			}
			catch (final IOException e) {
				throw new KNXMLException(e.getMessage());
			}
	}
89049
@Override
  public final void close() {
    try {
      doClose();
      isClosed = true;
    } catch (Exception e) {
      Throwables.propagate(e);
    }
  }