Try to call {@link ReferenceCounted#release(int)} if the specified message implements {@link ReferenceCounted}.
If the specified message doesn't implement {@link ReferenceCounted}, this method does nothing.
431770
public static boolean release(Object msg, int decrement) {
        if (msg instanceof ReferenceCounted) {
            return ((ReferenceCounted) msg).release(decrement);
        }
        return false;
    }
20654
public synchronized void release()
   {
      if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "release");

      released = true;
      valid = false;

      if (receivedBuffer != null)
      {
         receivedBuffer.release();
         receivedBuffer = null;
      }
      if (receivedData != null)
      {
         receivedData.release();
         receivedData = null;
      }

      if (dataList != null)
      {
         for (int x = 0; x < dataList.size(); x++)
         {
            dataList.get(x).release();
         }

         dataList.clear();
      }

      if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "release");
   }
425408
public void release() {
        if (lock != null) {
            try {
                lock.release();
                lock = null;
            } catch (IOException ex) {
                LOGGER.debug("Failed to release lock", ex);
            }
        }
        if (file != null) {
            try {
                file.close();
                file = null;
            } catch (IOException ex) {
                LOGGER.debug("Unable to delete lock file", ex);
            }
        }
        if (lockFile != null && lockFile.isFile()) {
            final String msg = readLockFile();
            if (msg != null && msg.equals(magic) && !lockFile.delete()) {
                LOGGER.error("Lock file '{}' was unable to be deleted. Please manually delete this file.", lockFile.toString());
                lockFile.deleteOnExit();
            }
        }
        lockFile = null;
        removeShutdownHook();
        final Timestamp timestamp = new Timestamp(System.currentTimeMillis());
        LOGGER.debug("Lock released ({}) {} @ {}", Thread.currentThread().getName(), magic, timestamp.toString());
    }
1136574
public void releaseExceptionallyAndReset(Throwable e) {
        ArrayList<CompletableFuture<T>> toComplete = null;
        synchronized (lock) {
            if (!waitingFutures.isEmpty()) {
                toComplete = new ArrayList<>(waitingFutures);
                waitingFutures.clear();
            }
            released = false;
            this.e = null;
            result = null;
            runningThreadId = null;
        }
        if (toComplete != null) {
            for (CompletableFuture<T> f : toComplete) {
                f.completeExceptionally(e);
            }
        }
    }
926002
@SuppressWarnings("unchecked")
    public static <T> T touch(T msg) {
        if (msg instanceof ReferenceCounted) {
            return (T) ((ReferenceCounted) msg).touch();
        }
        return msg;
    }
550985
public void release(Collection<T> release)
    {
        List<Ref<T>> refs = new ArrayList<>();
        List<T> notPresent = null;
        for (T obj : release)
        {
            Ref<T> ref = references.remove(obj);
            if (ref == null)
            {
                if (notPresent == null)
                    notPresent = new ArrayList<>();
                notPresent.add(obj);
            }
            else
            {
                refs.add(ref);
            }
        }

        IllegalStateException notPresentFail = null;
        if (notPresent != null)
        {
            notPresentFail = new IllegalStateException("Could not release references to " + notPresent
                                                       + " as references to these objects were not held");
            notPresentFail.fillInStackTrace();
        }
        try
        {
            release(refs);
        }
        catch (Throwable t)
        {
            if (notPresentFail != null)
                t.addSuppressed(notPresentFail);
        }
        if (notPresentFail != null)
            throw notPresentFail;
    }
933094
public void release() {
        if (released.compareAndSet(false, true)) {
            synchronized (releasingLock) {
                if (released.get()) {
                    impl.release(Integer.MAX_VALUE);
                }
            }
        }
    }
458238
void pin() {
		while (true) {
			int refCnt = pendingReferences.get();

			if (refCnt >= 0) {
				if (pendingReferences.compareAndSet(refCnt, refCnt + subpartitions.length)) {
					break;
				}
			}
			else {
				throw new IllegalStateException("Released.");
			}
		}
	}
1310642
synchronized CachedObject release(int i) {

        CachedObject r = (CachedObject) super.addOrRemove(i, null, true);

        if (r == null) {
            return null;
        }

        cacheBytesLength -= r.getStorageSize();

        r.setInMemory(false);

        return r;
    }
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;
        }
    }
257694
public synchronized void release(int count) {
        used -= count;
        if (used < 0)
            used = 0; // no negative number of ticket!
        if (logger.isDebugEnabled())
            logger.debug("Released " + count + " tickets! (Now " + this.toString() + ")");
        notifyAll();
    }
948736
protected final void fireUpdateWork(String message, long finished) {
	Iterator<WeakReference<ProgressObserver<Observable>>> iterator = observers
		.iterator();
	while (iterator.hasNext()) {
	    WeakReference<ProgressObserver<Observable>> weakReference = iterator
		    .next();
	    ProgressObserver<Observable> observer = weakReference.get();
	    if (observer == null) {
		observers.remove(weakReference);
	    } else {
		observer.updateWork(observable, message, finished);
	    }
	}
    }
992024
private void releasePendingMessage() {
        if (pendingMessage != null) {
            IRTMPEvent body = pendingMessage.getBody();
            if (body instanceof IStreamData && ((IStreamData<?>) body).getData() != null) {
                ((IStreamData<?>) body).getData().free();
            }
            pendingMessage = null;
        }
    }
1155483
public synchronized void unlock() throws SevereMessageStoreException
    {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "unlock", this);

        // If the subscription locks are down to zero then notify the threads waiting
        // for the subscriptionTable lock.
        synchronized (iMutex)
        {
            // If we are exclusively locked, then just return, as long as
            // the thread that is calling is the thread that holds the
            // exclusive lock.
            if (iExclusivelyLocked && iExclusiveLockHolder == Thread.currentThread())
            {
                if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "unlock");
                return;
            }

            // Decrement the lock count and notify the other threads if no
            // one holds the lock any more.
            if (--iLockCount == 0)
                notifyAll();

            if (iLockCount < 0)
            {
            	if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) SibTr.event(this, tc, "Unlock caused lock count to drop below zero!");
                if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "unlock");
                throw new SevereMessageStoreException("Unlock caused lock count to drop below zero!");
            }
        }

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "unlock");
    }
1163895
@Override
    public final void release()
    {
        assertNotReleased();

        _messages = null;
        _orderedMessages = null;
        _currentPhaseId = null;
        _responseStream = null;
        _responseWriter = null;
        _maximumSeverity = null;
        _partialViewContext = null;
        _renderKitFactory = null;
        _partialViewContextFactory = null;

        if (_facesContextFactory != null)
        {
            _facesContextFactory.release();
            _facesContextFactory = null;
        }

        // release FacesContextImplBase (sets current instance to null)
        super.release();
    }
478117
synchronized void release(CommsByteBuffer buff)
   {
      if (tc.isEntryEnabled()) SibTr.entry(this, tc, "release", buff);
      buff.reset();
      pool.add(buff);
      if (tc.isEntryEnabled()) SibTr.exit(this, tc, "release");
   }
1075263
public final void release() {
		synchronized (this.LOCK) {
			if ((this.owner != null)
					&& (this.owner.get() == Thread.currentThread())) {
				this.acquire--;

				if (this.acquire == 0) {
					this.owner = null;
					this.LOCK.notify();
				}

				return;
			}

			if ((this.owner != null) && (this.owner.get() == null)) {
				this.owner = null;
				this.acquire = 0;
				this.LOCK.notify();
			}

			throw new IllegalMonitorStateException(Thread.currentThread()
					.getName()
					+ " is not the owner of the lock. "
					+ ((this.owner != null) ? ((Thread) this.owner.get())
							.getName() : "nobody") + " is the owner.");
		}
	}