Closes the handler.

@param join if the method should wait for the thread to finish before returning.
488090
public void shutdown(boolean join) {
        ThreadPoolExecutor pool = executor;
        executor = null;
        pool.shutdown(); // Disable new tasks from being submitted
        if (join) {
            try {
                // Wait a while for existing tasks to terminate
                if (!pool.awaitTermination(WAIT_FOR_JOBS_SHUTDOWN_TIMEOUT, TimeUnit.SECONDS)) {
                    pool.shutdownNow(); // Cancel currently executing tasks
                    // Wait a while for tasks to respond to being cancelled
                    if (!pool.awaitTermination(WAIT_FOR_JOBS_SHUTDOWN_TIMEOUT, TimeUnit.SECONDS)) {
                        logger.error("Pool did not terminate");
                    }
                }
            } catch (InterruptedException ie) {
                // (Re-)Cancel if current thread also interrupted
                pool.shutdownNow();
                // Preserve interrupt status
                Thread.currentThread().interrupt();
            }
        }
    }
1239524
@Override
  public void close() throws IOException {
    checkState(isInitialized, "initialize() must be invoked before use.");
    if (isOpen()) {
      try {
        pipeSinkChannel.close();
        handleResponse(waitForCompletionAndThrowIfUploadFailed());
      } finally {
        pipeSinkChannel = null;
        uploadOperation = null;
      }
    }
  }
877967
public void close() throws IOException
  {
      if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
      {
        Tr.debug(tc, "close");
      }
      closed = true;
      this.output.close();
  }
17799
public void close()
        throws IOException
    {
        try{
            _completing=true;
            if (_connection instanceof Socket && !(_connection instanceof SSLSocket))
                ((Socket)_connection).shutdownOutput();
            _outputStream.close();
            _inputStream.close();
        }
        finally
        {
            if (_handlingThread!=null && Thread.currentThread()!=_handlingThread)
                _handlingThread.interrupt();
        }
    }
1088251
final void end() {
    final Thread thread = this.threadRef;
    this.keepRunning.set(false);
    if (thread != null) {
     // thread.interrupt();
      try {
        thread.join();
      } catch (InterruptedException e) {
        Thread.currentThread().interrupt();
      }
    }
    this.threadRef = null;
  }
108735
public void close()
   {
      // stop index merger
      // when calling this method we must not lock this MultiIndex, otherwise
      // a deadlock might occur
      if (merger != null)
      {
         merger.dispose();
         merger = null;
      }
      
      synchronized (this)
      {
         try
         {
            // stop timer
            if (flushTask != null)
            {
               flushTask.cancel();
            }

            // commit / close indexes
            try
            {
               releaseMultiReader();
            }
            catch (IOException e)
            {
               LOG.error("Exception while closing search index.", e);
            }
            if (modeHandler.getMode().equals(IndexerIoMode.READ_WRITE))
            {
               try
               {
                  flush();
               }
               catch (IOException e)
               {
                  LOG.error("Exception while closing search index.", e);
               }
            }
            volatileIndex.close();
            for (int i = 0; i < indexes.size(); i++)
            {
               (indexes.get(i)).close();
            }

            // finally close directory
            try
            {
               indexDir.close();
            }
            catch (IOException e)
            {
               LOG.error("Exception while closing directory.", e);
            }
            modeHandler.removeIndexerIoModeListener(this);
            indexUpdateMonitor.removeIndexUpdateMonitorListener(this);
            this.stopped.set(true);
         }
         finally
         {
            // Remove the hook that will stop the threads if they are still running
            SecurityHelper.doPrivilegedAction(new PrivilegedAction<Object>()
            {
               public Void run()
               {
                  try
                  {
                     Runtime.getRuntime().removeShutdownHook(hook);
                  }
                  catch (IllegalStateException e)
                  {
                     // can't register shutdown hook because
                     // jvm shutdown sequence has already begun,
                     // silently ignore...
                     if (LOG.isTraceEnabled())
                     {
                        LOG.trace("An exception occurred: " + e.getMessage());
                     }
                  }
                  return null;
               }
            });
         }
      }
   }
565589
void close() {

        final String methodName = "close";
        if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
            SibTr.entry(this, TRACE, methodName);
        }

        /*
         * Cancel any ongoing dispatch
         */
        _cancelled = true;

        if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) {
            SibTr.exit(this, TRACE, methodName);
        }

    }
480778
public void close()
	{
		synchronized (closeLock)
		{
			if (closed)
				return;		
			closed = true;
		}
		
		synchronized (this)
		{
			Iterator<T> allObjects = all.iterator();
			while (allObjects.hasNext())
			{
				T poolObject = allObjects.next();
				internalDestroyPoolObject(poolObject);
			}
			
			all.clear();
			available.clear();
			
			// Unlock all waiting threads
			notifyAll();
		}
	}
1107087
public static void close(@Nullable Object object) throws IOException {
		if (object instanceof Closeable) {
			((Closeable) object).close();
		}
	}
522276
@Override
	public void close() {
		try {
			if (!jacksonParser.isClosed())
				jacksonParser.close();
		} catch (IOException e) {
			e.printStackTrace();
			throw(new KriptonRuntimeException(e));
		}
		
	}
148340
@Override
	public void close() {
		try {
			connection.close();
		} catch(IOException e) {
			log.log(Level.WARNING, "Could not close connection", e);
		}
	}
727387
public synchronized void close()
    {
        Preconditions.checkState(state.compareAndSet(State.STARTED, State.CLOSED), "Already closed or has not been started");

        client.getConnectionStateListenable().removeListener(listener);
        executorService.close();
        ourTask.set(null);
    }
900176
void close() {
    broadcastFuture.cancel(false);
    groupMembershipService.removeListener(groupMembershipEventListener);
    clusterMembershipService.removeListener(clusterMembershipEventListener);
  }
665563
protected final void close() {
		if (SwingUtilities.isEventDispatchThread()) {
			closeIntern();
		} else {
			try {
				SwingUtilities.invokeAndWait(new Runnable() {
					public void run() {
						closeIntern();
					}
				});
			} catch (final Exception ex) {
				ignore();
			}
		}
	}
605281
public void close() {
        done = true;
        connected = false;
        synchronized (this) {
            try {
                if (socket != null) {
                    if (traceLevel >= ctrlThreshold) {
                        System.out.println("-> CLOSE");
                    }
                    socket.close();
                }
            } catch (final IOException e) { /* ignore socket close errors */
            } finally {
                socket = null;
            }
        }
    }
398180
public void close() {
		if (thread == null) {
			closed = true;
		}

		running = false;

		if (thread != null) {
			thread.interrupt();
		}
	}
359994
@Override
	public void close() throws IOException {
		boolean enqueueOnSocketClose;
		synchronized(closeLock) {
			if(closeTime == null) {
				// Remove this from the context
				socketContext.onClose(this);
				closeTime = System.currentTimeMillis();
				enqueueOnSocketClose = true;
			} else {
				enqueueOnSocketClose = false;
			}
		}
		if(enqueueOnSocketClose) {
			Future<?> future = listenerManager.enqueueEvent(
				new ConcurrentListenerManager.Event<SocketListener>() {
					@Override
					public Runnable createCall(final SocketListener listener) {
						return new Runnable() {
							@Override
							public void run() {
								listener.onSocketClose(AbstractSocket.this);
							}
						};
					}
				}
			);
			try {
				logger.log(Level.FINE, "Waiting for calls to onSocketClose to complete");
				future.get();
				logger.log(Level.FINE, "All calls to onSocketClose finished");
			} catch(ExecutionException e) {
				logger.log(Level.SEVERE, null, e);
			} catch(InterruptedException e) {
				logger.log(Level.SEVERE, null, e);
				// Restore the interrupted status
				Thread.currentThread().interrupt();
			}
		}
		listenerManager.close();
	}