Force-close this {@link Recycler}, by forcibly moving any instances that have been acquired but not yet
recycled into the unused instances list, then calling {@link #close()} to close any {@link AutoCloseable}
instances and discard all instances.
779233
public void forceClose() {
        // Move all elements from usedInstances to unusedInstances in a threadsafe way
        for (final T usedInstance : new ArrayList<>(usedInstances)) {
            if (usedInstances.remove(usedInstance)) {
                unusedInstances.add(usedInstance);
            }
        }
        close();
    }
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);
            }
        }
    }
12885
public synchronized void close()
                    throws ObjectManagerException {
        final String methodName = "close";
        if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
            trace.entry(this, cclass, methodName);

        super.close();

        if (Tracing.isAnyTracingEnabled() && trace.isEntryEnabled())
            trace.exit(this, cclass, methodName);
    }
117039
@Override
    public void close() throws Exception {
        if (scopeCleaner.close()) { // executor thread to exit processing loop            
            LOGGER.info("closing PreDestroyMonitor...");
            List<Map.Entry<Object, UnscopedCleanupAction>> actions = new ArrayList<>(cleanupActions.entrySet());
            if (actions.size() > 0) {
                LOGGER.warn("invoking predestroy action for {} unscoped instances", actions.size());
                actions.stream().map(Map.Entry::getValue).collect(
                    Collectors.groupingBy(UnscopedCleanupAction::getContext, Collectors.counting())).forEach((source, count)->{
                        LOGGER.warn("  including {} objects from source '{}'", count, source);
                    });
            }
            actions.stream().sorted(Map.Entry.comparingByValue()).forEach(action->{
                Optional.ofNullable(action.getKey()).ifPresent(obj->action.getValue().call(obj));                    
            });             
            actions.clear();
            cleanupActions.clear();
            scopeBindings.clear();
            scopeBindings = Collections.emptyMap();
        } else {
            LOGGER.warn("PreDestroyMonitor.close() invoked but instance is not running");
        }
    }
57354
public void clearRecycle()
  {
    ArrayList<ClientSocket> recycleList = null;

    synchronized (this) {
      _idleHead = _idleTail = 0;

      for (int i = 0; i < _idle.length; i++) {
        ClientSocket stream;

        stream = _idle[i];
        _idle[i] = null;

        if (stream != null) {
          if (recycleList == null)
            recycleList = new ArrayList<ClientSocket>();

          recycleList.add(stream);
        }
      }
    }

    if (recycleList != null) {
      for (ClientSocket stream : recycleList) {
        stream.closeImpl();
      }
    }
  }
784484
@Override
	public void close() {
		synchronized (this) {
			if (object != null) {
				T object_ = object;
				object = null;
				try {
					finalizer.accept(object_);
				} catch (Exception e) {
					// Ignored
				}
			}
		}
	}
1292821
@Override
	public void close() {
		if (leaf != null) {
			leaf.close();
			leaf = null;
		}
		dirsMayBeUpdated = null;
	}
1142855
public void close() throws Exception {
        this.files.clear();
        this.files = new ArrayList<File>();
        this.iterator = this.files.iterator();
    }
1240001
public static void close(@CheckForNull AutoCloseable c) {
        if (c == null) {
            return;
        }

        try {
            c.close();
        } catch (Exception e) {
            // Ignore
        }
    }
208146
public static final <T extends Recyclable> T get(Class<T> cls, Consumer<T> initializer)
    {
        T recyclable = null;
        lock.lock();
        try
        {
            List<Recyclable> list = mapList.get(cls);
            if (list != null && !list.isEmpty())
            {
                recyclable = (T) list.remove(list.size()-1);
                log.debug("get recycled %s", recyclable);
            }
        }
        finally
        {
            lock.unlock();
        }
        if (recyclable == null)
        {
            try
            {
                recyclable = cls.newInstance();
                log.debug("create new recycled %s", recyclable);
            }
            catch (InstantiationException | IllegalAccessException ex)
            {
                throw new IllegalArgumentException(ex);
            }
        }
        if (initializer != null)
        {
            initializer.accept(recyclable);
        }
        return (T) recyclable;
    }
1131652
private void destroy() {
        if (queue != null) {

            if (!queue.isEmpty()) {
                logger.trace("Non-empty queue: {}", queue);

                if (releaseMessages) {
                    Object msg;
                    while ((msg = queue.poll()) != null) {
                        ReferenceCountUtil.safeRelease(msg);
                    }
                }
            }

            queue.recycle();
            queue = null;
        }
    }
403790
public static void close(Closeable closeable) {
        if (closeable != null) {
            try {
                closeable.close();
            } catch (IOException ioe) {
                // Suppress the exception
                logger.log(Level.FINEST, "Unable to close resource.", ioe);
            }
        }
    }
698756
@Override
	public void close() {
		try {
			sortAndReduce();
		} catch (Exception e) {
			throw new ExceptionInChainedStubException(this.taskName, e);
		}

		this.outputCollector.close();
	}
116000
public Future<Void> forceClose() {
    this.close();
    if (forceClosing.compareAndSet(false, true) && channel.isOpen()) {
      writeCoalescer
          .writeAndFlush(channel, FORCEFUL_CLOSE_MESSAGE)
          .addListener(UncaughtExceptions::log);
    }
    return channel.closeFuture();
  }
1151424
@Override
    protected void dispose() {
        try {
            if (generator != null) {
                generator.writeEndArray();
                generator.close();
            }
            this.getOutputStream().close();
        } catch (IOException ioe) {
            logger.error("Unable to close stream", ioe);
            logger.trace(ioe.getMessage(), ioe);
        } finally {
            generator = null;
            this.setOutputStream(null);
        }
    }
1373235
public void recycle() {
    	while(buffer.size()>0)
    		buffer.poll().recycle();
    	
    	if(activeFrame!=null)
    		activeFrame.recycle();
    	
        activeFrame=null;
		activeData=null;
		byteIndex=0;		        
    }
18553
@Override
    public void close()
    {
        isOpen.set(false);
        Iterator<Future<?>> iterator = futures.iterator();
        while ( iterator.hasNext() )
        {
            Future<?> future = iterator.next();
            iterator.remove();
            if ( !future.isDone() && !future.isCancelled() && !future.cancel(true) )
            {
                log.warn("Could not cancel " + future);
            }
        }
        if (shutdownOnClose) {
            executorService.shutdownNow();
        }
    }