Should be called if the Thread that uses this cache is about to exist to release resources out of the cache
347663
void free(boolean finalizer) {
        // As free() may be called either by the finalizer or by FastThreadLocal.onRemoval(...) we need to ensure
        // we only call this one time.
        if (freed.compareAndSet(false, true)) {
            int numFreed = free(tinySubPageDirectCaches, finalizer) +
                    free(smallSubPageDirectCaches, finalizer) +
                    free(normalDirectCaches, finalizer) +
                    free(tinySubPageHeapCaches, finalizer) +
                    free(smallSubPageHeapCaches, finalizer) +
                    free(normalHeapCaches, finalizer);

            if (numFreed > 0 && logger.isDebugEnabled()) {
                logger.debug("Freed {} thread-local buffer(s) from thread: {}", numFreed,
                        Thread.currentThread().getName());
            }

            if (directArena != null) {
                directArena.numThreadCaches.getAndDecrement();
            }

            if (heapArena != null) {
                heapArena.numThreadCaches.getAndDecrement();
            }
        }
    }
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.");
		}
	}
1084628
public void releasePutFromLoadLock(Object key, Lock lock) {
		if (trace) {
			log.tracef("releasePutFromLoadLock(%s#%s, %s)", cache.getName(), key, lock);
		}
		final PendingPutMap pending = (PendingPutMap) lock;
		if ( pending != null ) {
			if ( pending.canRemove() ) {
				pending.setRemoved();
				pendingPuts.remove( key, pending );
			}
			pending.releaseLock();
		}
	}
920873
public void shutdown() {
    if (shutdown) {
      return;
    }
    cache.clear();
    stats.shutdown();
    dispatcher.shutdown();
    if (closeableCache != null) {
      try {
        closeableCache.close();
      } catch (IOException ignored) {
      }
    }
    for (DeferredRequestCreator deferredRequestCreator : targetToDeferredRequestCreator.values()) {
      deferredRequestCreator.cancel();
    }
    targetToDeferredRequestCreator.clear();
    shutdown = true;
  }
1241110
private boolean checkCache() {
        if (this.cacheValid) {
            long now = System.nanoTime();
            if ((now - this.cacheExpiryTime) > 0) {
                this.cacheValid = false;
            }
        }
        return this.cacheValid;
    }
1372787
public void deregisterThread(StoppableThread thread)
  {
    if (tc.isEntryEnabled())
      SibTr.entry(tc, "deregisterThread", thread);
      
    synchronized (this)
    {
      _threadCache.remove(thread);
    } 
    
    if (tc.isEntryEnabled())
      SibTr.exit(tc, "deregisterThread");
  }
1277918
public void stop() {
      counterCacheStarted.set(true); //avoid starting the counter cache if it hasn't started yet
      if (listener != null && stateCache != null) {
         stateCache.removeListener(listener);
      }
      listener = null;
      stateCache = null;
   }
1134376
function(exists, done) {
      if (exists) {
        done(new AbstractCache.Error('The cache is currently locked.'))
      } else {
        client.get("lock-process:" + name, done)
      }
    }
143799
function () {
				var pReset, oMsr = startMeasurements("reset");
				Log.debug("Cache Manager: Reset called.");

				pReset = this._callInstanceMethod("reset", arguments).then(function callInstanceHandler() {
					Log.debug("Cache Manager: Reset completed successfully.");
					oMsr.endAsync();
					//nothing to return, just logging.
				}, function (e) {
					Log.debug("Cache Manager: Reset failed. Error: " + e);
					oMsr.endAsync();
					throw e;
				});
				oMsr.endSync();
				return pReset;
			}
1148171
def release(self):
        
        if self.errored:
            self.pool.delete_resource(self)
        else:
            self.pool.release(self)
392811
def cache(self, con):
        """"""
        self._lock.acquire()
        try:
            if not self._maxcached or len(self._idle_cache) < self._maxcached:
                con._reset(force=self._reset)  # rollback possible transaction
                # the idle cache is not full, so put it there
                self._idle_cache.append(con)  # append it to the idle cache
            else:  # if the idle cache is already full,
                con.close()  # then close the connection
            self._connections -= 1
            self._lock.notify()
        finally:
            self._lock.release()
697226
public void stopThread(StoppableThreadCache threadCache)
  {
    if (tc.isEntryEnabled())
      SibTr.entry(tc, "stopThread", threadCache);
    
    synchronized (_messageProcessor.getDestinationManager().deletionThreadLock)
    {    
      // Allow the thread to finish the immediate job in hand before
      // returning.
      //set the thread to stopping, so that it'll stop if in progress
      // and no new instances will be started         
      setStopping();
  
      // Now wait till the thread's gone
      while (isRunning())
      {
        try
        {
          // wait for thread to end
          // I put a timeout on this - to handle the case where we've hung
          // in delete processing. The best thing in such a case is probably
          // to allow the whole process to exit.
  
          // But is 5 secs right? - NY
          _messageProcessor.getDestinationManager().deletionThreadLock.wait(5000);
          if (Thread.holdsLock(asynchLock)) asynchLock.wait(5000);
        }
        catch (InterruptedException iex)
        {
          // No FFDC code needed
          SibTr.exception(tc, iex);
        }
      }
    }
    
    // Remove this thread from the thread cache
    threadCache.deregisterThread(this);
   
    if (tc.isEntryEnabled())
      SibTr.exit(tc, "stopThread");
  }
413378
private void ensureCleanStartup() {
        forceShutdown();
        ScheduledThreadPoolExecutor oldPool = pool.getAndSet(createScheduledThreadExecutor());
        oldPool.shutdownNow();
        claimedForHandoff.clear();
        workUnitsPeggedToMe.clear();
        state.set(NodeState.Fresh);
    }
86956
public void cacheCleared(String cacheName) {
            InvalidationTableList list = (InvalidationTableList) cacheinvalidationTables.get(cacheName);
            if (list != null ) 
                    list.clear();
	}
1351731
protected function ensure_cachelock_available() {
        if ($this->cachelockinstance === null) {
            $this->cachelockinstance = cache_helper::get_cachelock_for_store($this->get_store());
        }
    }
1187329
public void remove() {
        Thread thread = Thread.currentThread();
        if (thread instanceof ThreadPool.Worker) {
            Object[] wsLocals = getThreadLocals((ThreadPool.Worker) thread);
            wsLocals[index] = null;
        } else {
            super.remove();
        }
    }
266574
void invalidateToStringCache() {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(this, tc, "invalidateToStringCache");

        // Invalidate the toString cache.
        cachedToString = null;

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(this, tc, "invalidateToStringCache");
    }