Dispose of object, releasing resources. It's very important to call this
method when you are done with this object. It will release any resources
used by it such as service connections. Naturally, once the object is
disposed of, it can't be used again.
353443
public void dispose() {
        logDebug("Disposing.");
        mSetupDone = false;
        if (mServiceConn != null) {
            logDebug("Unbinding from service.");
            if (mContext != null) mContext.unbindService(mServiceConn);
        }
        mDisposed = true;
        mContext = null;
        mServiceConn = null;
        mService = null;
        mPurchaseListener = null;
    }
1232823
@Override
    public void discard() {
        final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
        if (isTraceOn && tc.isEntryEnabled()) {
            Tr.entry(tc, "discard");
        }

        discarded = true;

        if (state == DESTROYED) {
            return;
        }

        setState(DESTROYED);

        destroyHandleList();

        // Release any JCDI creational contexts that may exist.         F743-29174
        this.releaseManagedObjectContext();

        if (pmiBean != null) {
            pmiBean.discardCount(); // F743-27070
            pmiBean.beanDestroyed();
        }

        if (isTraceOn && tc.isEntryEnabled()) {
            Tr.exit(tc, "discard");
        }
    }
782700
@Override
  public void close() {
    if (isClosed())
      return;

    checkOpeness();
    rollback();

    final OMetadata md = getMetadata();
    if (md != null)
      md.close();

    ((ODatabaseRaw) ((ODatabaseRecord) underlying).getUnderlying()).callOnCloseListeners();
    getLevel1Cache().clear();

    ownerPool.release(this);
    ownerPool = null;
  }
499188
protected void dispose() {
		// Remove shutdown hook to prevent resource leaks
		ShutdownHookUtil.removeShutdownHook(shutdownHook, getClass().getSimpleName(), LOG);

		try {
			PlanExecutor executor = this.executor;
			if (executor != null) {
				executor.stop();
			}
		}
		catch (Exception e) {
			throw new RuntimeException("Failed to dispose the session shutdown hook.");
		}
	}
393283
void close() {
        if (this.project != null) {
            Util.logger().log(Level.FINE, "Closing Protege project {0}",
                    this.projectIdentifier);

            for (Iterator<ProjectListener> itr =
                         this.projectListeners.iterator(); itr.hasNext(); ) {
                this.project.removeProjectListener(itr.next());
                itr.remove();
            }
            try {
                this.project.dispose();
                Util.logger().fine("Done closing connection.");
            } catch (IllegalStateException e) {
                /*
                 * Protege registers a shutdown hook that is removed when
                 * dispose() is called on a project. However, we might call this
                 * method during an already started shutdown process. See
                 * documentation for java.lang.Runtime.removeShutdownHook. This
                 * exception should be harmless, unless there are other reasons
                 * dispose() could throw this exception?
                 */
                Util.logger().fine("Done closing connection.");
            } finally {
                this.project = null;
            }

        }
    }
1050053
public void deleteObject(Object object)
    {
        PersistenceBroker broker = null;
        try
        {
            broker = getBroker();
            broker.delete(object);
        }
        finally
        {
            if (broker != null) broker.close();
        }
    }
194544
public void dispose() {
        try {
            connection.close();
        } catch (final Exception e) {
            LOGGER.log(Level.ERROR, "Disposes transaction [" + getId() + "] failed", e);
        } finally {
            isActive = false;
            connection = null;
            JdbcRepository.TX.set(null);
        }
    }
720751
@Override
    public void close() {
        if (this.closed.compareAndSet(false, true)) {
            // Clean up the map, just in case the caller still has a pointer to this object.
            this.map.clear();

            Consumer<String> callback = this.closeCallback;
            if (callback != null) {
                Callbacks.invokeSafely(callback, this.id, null);
            }
        }
    }
760012
@Override public void close () {
    if (!disposed) {
      disposed = true;
      if (gfx.exec().isMainThread()) {
        gfx.gl.glDeleteTexture(id);
      } else {
        gfx.exec().invokeNextFrame(new Runnable() {
          public void run () { gfx.gl.glDeleteTexture(id); }
        });
      }
    }
  }
101810
public void dispose() {
        synchronized (this) {
            if (serviceRegistration == null) {
                throw new IllegalStateException(String.format("%s [%s] had not been registered.", getClass()
                    .getSimpleName(), this));
            }
            serviceRegistration.unregister();
            serviceRegistration = null;
        }
    }
59427
function () {
            this.__ending = true;
            var conn, fQueue = this.__freeObjects, count = this.count, ps = [];
            while ((conn = this.__freeObjects.dequeue()) !== undefined) {
                ps.push(this.closeConnection(conn));
            }
            var inUse = this.__inUseObjects;
            for (var i = inUse.length - 1; i >= 0; i--) {
                ps.push(this.closeConnection(inUse[i]));
            }
            this.__inUseObjects.length = 0;
            return new PromiseList(ps).promise();
        }
510457
@Override
  public synchronized void close() {
    if (endHandler != null) {
      endHandler.handle(null);
    }
    closed = true;
    if (listener != null && handleCalled) {
      listener.sessionClosed();
    }
  }
536742
protected void postDestroyConnection(ConnectionHandle handle){
		ConnectionPartition partition = handle.getOriginatingPartition();

		if (this.finalizableRefQueue != null && handle.getInternalConnection() != null){ //safety
			this.finalizableRefs.remove(handle.getInternalConnection());
			//			assert o != null : "Did not manage to remove connection from finalizable ref queue";
		}

		partition.updateCreatedConnections(-1);
		partition.setUnableToCreateMoreTransactions(false); // we can create new ones now, this is an optimization


		// "Destroying" for us means: don't put it back in the pool.
		if (handle.getConnectionHook() != null){
			handle.getConnectionHook().onDestroy(handle);
		}

	}
215350
function releaseObject(object) {
    object.criteria = object.value = null;
    if (objectPool.length < MAX_POOL_SIZE) {
      objectPool.push(object);
    }
  }
1194298
public void dispose() {
		for (int layer = 0; layer < 4; layer++) {
			Graphics2D graphics = layeredGraphics[layer];
			if (graphics != null) {
				graphics.dispose();
				layeredGraphics[layer] = null;
			}
			BufferedImage image = layeredImage[layer];
			if (image != null) {
				image.flush();
				layeredImage[layer] = null;
			}
		}
	}
302600
@Override
	public void dispose() {

		IOUtils.closeQuietly(cancelStreamRegistry);

		if (kvStateRegistry != null) {
			kvStateRegistry.unregisterAll();
		}

		lastName = null;
		lastState = null;
		keyValueStatesByName.clear();
	}
205894
function () {
        // just to be sure! clear all items in the connections object. they should be cleared by now
        util.each(this.connections, function (value, prop, conns) {
            try {
                value.release();
            }
            catch (e) { } // nothing to do with error
            delete conns[prop];
        });

        // now execute end on the databases. will end pool if pool, or otherwise will execute whatever
        // `end` that has been exposed by db.js
        util.each(Transaction.databases, function (value, prop, databases) {
            value.end();
            databases[prop] = null;
        });
    }