region AutoCloseable Implementation
480047
@Override
    public void close() {
        if (!this.closed.getAndSet(true)) {
            // Close all containers that are still open.
            ArrayList<CompletableFuture<Void>> results = new ArrayList<>();
            synchronized (this.handles) {
                ArrayList<ContainerHandle> toClose = new ArrayList<>(this.handles.values());
                for (ContainerHandle handle : toClose) {
                    results.add(this.registry.stopContainer(handle, CLOSE_TIMEOUT_PER_CONTAINER));
                }
            }

            // Wait for all the containers to be closed.
            Futures.await(Futures.allOf(results), CLOSE_TIMEOUT_PER_CONTAINER.toMillis());
        }
    }
1370298
private static void collapseIfPossible(FastAdapter fastAdapter) {
        try {
            Class c = Class.forName("com.mikepenz.fastadapter.expandable.ExpandableExtension");
            if (c != null) {
                IAdapterExtension extension = fastAdapter.getExtension(c);
                if (extension != null) {
                    Method method = extension.getClass().getMethod("collapse");
                    method.invoke(extension);
                }
            }
        } catch (Exception ignored) {
            //
        }
    }
294381
public static void close(Closeable c) {
		try {
			if (c != null) {
				c.close();
			}
		} catch (IOException e) {
			logger.warn("Cannot close down the given Closeable object", e);
		}
	}
340011
private void closeRemainingEnumerations()
    {
        List<AbstractQueueBrowserEnumeration> enumsToClose = new Vector<>();
        synchronized (enumMap)
        {
        	enumsToClose.addAll(enumMap.values());
            for (int n = 0 ; n < enumsToClose.size() ; n++)
            {
            	AbstractQueueBrowserEnumeration queueBrowserEnum = enumsToClose.get(n);
                log.debug("Auto-closing unclosed queue browser enumeration : "+queueBrowserEnum);
                try
                {
                	queueBrowserEnum.close();
                }
                catch (Exception e)
                {
                    log.error("Could not close queue browser enumeration "+queueBrowserEnum,e);
                }
            }
        }
    }
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();
    }
977506
@Override
    @SneakyThrows(Exception.class)
    public void close() {
        ReusableLatch waitSignal = null;
        synchronized (this.stateLock) {
            if (this.closed) {
                return;
            }

            this.closed = true;
            if (this.activeCount != 0 || !this.pendingItems.isEmpty()) {
                // Setup a latch that will be released when the last item completes.
                this.emptyNotifier = new ReusableLatch(false);
                waitSignal = this.emptyNotifier;
            }
        }

        if (waitSignal != null) {
            // We have unfinished items. Wait for them.
            waitSignal.await(CLOSE_TIMEOUT_MILLIS);
        }
    }
158445
protected void _closeChild()
    {
        if (_child != null) {
            Object value = _child._safeFinish();
            _map.put(_fieldName, value);
            _child = null;
        }
    }
829559
protected void close() {

        if (!m_enabled) {
            return;
        }
        m_openClose.setDown(false);
        m_popup.hide();
        m_selectBoxState.setValue(I_CmsLayoutBundle.INSTANCE.generalCss().cornerAll());
    }
1135325
public static void closeAllQuietly(Iterable<? extends AutoCloseable> closeables) {
		if (null != closeables) {
			for (AutoCloseable closeable : closeables) {
				closeQuietly(closeable);
			}
		}
	}
46333
def OnClose(self, event):
        """"""

        # If changes have taken place save of old grid

        if undo.stack().haschanged():
            save_choice = self.interfaces.get_save_request_from_user()

            if save_choice is None:
                # Cancelled close operation
                return

            elif save_choice:
                # User wants to save content
                post_command_event(self.main_window, self.main_window.SaveMsg)

        # Save the AUI state

        config["window_layout"] = repr(self.main_window._mgr.SavePerspective())

        # Uninit the AUI stuff

        self.main_window._mgr.UnInit()

        # Save config
        config.save()

        # Close main_window

        self.main_window.Destroy()

        # Set file mode to 600 to protect GPG passwd a bit
        sp = wx.StandardPaths.Get()
        pyspreadrc_path = sp.GetUserConfigDir() + "/." + config.config_filename
        try:
            os.chmod(pyspreadrc_path, 0600)
        except OSError:
            dummyfile = open(pyspreadrc_path, "w")
            dummyfile.close()
            os.chmod(pyspreadrc_path, 0600)
1065634
private void closeInputGates() throws IOException, InterruptedException {
		for (int i = 0; i < this.inputGates.size(); i++) {
			final InputGate<? extends IOReadableWritable> eig = this.inputGates.get(i);
			// Important: close must be called on each input gate exactly once
			eig.close();
		}

	}
1095235
@Override
    public void close() throws IOException {
        if (!closed) {
            closed = true;
            nodeCursor = null;
            _currToken = null;
        }
    }
496716
public void close(AutoCloseable closeable) {
    try {
      closeable.close();
    } catch (Exception e) {
      throw new IllegalStateException("Fail to close " + closeable, e);
    }
  }
1309624
@Override
    public void close() throws IOException {
        try {
            if (inPart)
                out.write(__CRLF);
            out.write(__DASHDASH);
            out.write(boundary);
            out.write(__DASHDASH);
            out.write(__CRLF);
            inPart = false;
        } finally {
            super.close();
        }
    }
857712
function () {
      if (!autofill.handle) {
        autofill.handle = new Handsontable.FillHandle(self);
        autofill.fillBorder = new Handsontable.Border(self, {
          className: 'htFillBorder'
        });

        $(autofill.handle.handle).on('dblclick', autofill.selectAdjacent);
      }
      else {
        autofill.handle.disabled = false;
        autofill.fillBorder.disabled = false;
      }

      self.rootElement.on('beginediting.handsontable', function () {
        autofill.hideHandle();
      });

      self.rootElement.on('finishediting.handsontable', function () {
        if (selection.isSelected()) {
          autofill.showHandle();
        }
      });
    }
1373394
public static void close(final AutoCloseable closeable)
    {
        try
        {
            if (null != closeable)
            {
                closeable.close();
            }
        }
        catch (final Exception e)
        {
            LangUtil.rethrowUnchecked(e);
        }
    }
1295733
static <T> FluentCloseableIterable<T> wrap(final Iterable<T> iterable, final AutoCloseable closeable) {
        return new FluentCloseableIterable<T>() {
            @Override
            protected void doClose() {
                try {
                    closeable.close();
                } catch (RuntimeException re) {
                    throw re;
                } catch (Exception e) {
                    throw new IllegalStateException(e);
                }
            }

            @Override
            protected Iterator<T> retrieveIterator() {
                return iterable.iterator();
            }
        };
    }