Remove expired entries.

@param expireHandler implementation that will be called for each expired entry.
3274
int removeExpired(TimeoutHandler expireHandler)
    {
        // ensure the clock never goes backwards
        long t = ticker.currentTimeMillis();

        int expired = 0;
        for (int i = 0; i < slotCount; i++)
        {
            expired += slots[i].removeExpired(t, expireHandler);
        }
        return expired;
    }
561275
public void setExpiration(String expiration) {
        if (expiration == null) {
            _properties.remove(AMQP_PROP_EXPIRATION);
            return;
        }
        
        _properties.put(AMQP_PROP_EXPIRATION, expiration);
    }
1043155
public function handleExpiredWorkerHandlers()
    {
        if (!$this->hasExpiredWorkerHandler()) {
            return;
        }

        foreach ($this->request as $request) {
            $worker_handler_id = $request->getWorkerHandlerId();

            if ($this->hasWorkerHandler($worker_handler_id)) {
                continue;
            }

            $this->addWorkerQueue($request->getId());

            $this->getLogger()->info(
                sprintf(
                    'WorkerHandler %s for request %s is expired. '.
                    'Therefore, the request is queued again.',
                    $worker_handler_id,
                    $request->getId()
                )
            );
        }
    }
566850
def delete_expired_locks(self):
        
        ttl_seconds = self.get_mutex_ttl_seconds()
        if ttl_seconds is not None:
            DBMutex.objects.filter(creation_time__lte=timezone.now() - timedelta(seconds=ttl_seconds)).delete()
551102
def ExpirePrefix(self, prefix):
    """"""
    for key in list(self._hash):
      if key.startswith(prefix):
        self.ExpireObject(key)
629641
@GuardedBy("evictionLock")
  void expireAfterAccessEntries(AccessOrderDeque<Node<K, V>> accessOrderDeque, long now) {
    long duration = expiresAfterAccessNanos();
    for (;;) {
      Node<K, V> node = accessOrderDeque.peekFirst();
      if ((node == null) || ((now - node.getAccessTime()) < duration)) {
        return;
      }
      evictEntry(node, RemovalCause.EXPIRED, now);
    }
  }
1277522
def clean_old_entries():
    """"""
    from indico_livesync.plugin import LiveSyncPlugin
    from indico_livesync.models.queue import LiveSyncQueueEntry

    queue_entry_ttl = LiveSyncPlugin.settings.get('queue_entry_ttl')
    if not queue_entry_ttl:
        return
    expire_threshold = now_utc() - timedelta(days=queue_entry_ttl)
    LiveSyncQueueEntry.find(LiveSyncQueueEntry.processed,
                            LiveSyncQueueEntry.timestamp < expire_threshold).delete(synchronize_session='fetch')
50386
public synchronized void removeExpired()
   {
      final List<String> removeLockList = new ArrayList<String>();

      for (LockData lock : getLockList())
      {
         if (!lock.isSessionScoped() && lock.getTimeToDeath() < 0)
         {
            removeLockList.add(lock.getNodeIdentifier());
         }
      }

      Collections.sort(removeLockList);

      for (String rLock : removeLockList)
      {
         removeLock(rLock);
      }
   }
916449
private void tryExpire(boolean force, LongSupplier time) {
    long now = time.getAsLong();
    if (force || now >= nextPruning) {
      nextPruning = now + pruningDelay;
      histogram.expire(now);
    }
  }
1325439
public synchronized static void clearHandlers() {
      java.util.logging.Logger root = java.util.logging.LogManager.getLogManager().getLogger(StringUtils.EMPTY);
      Handler[] handlers = root.getHandlers();
      for (Handler h : handlers) {
         root.removeHandler(h);
      }
   }
607822
public void expire(long time) {
    long calculatedSize = 0;
    Iterator<Bar> it = bars.iterator();
    while (it.hasNext()) {
      long barSize = it.next().expire(time);
      if (barSize == 0) {
        it.remove();
      }
      calculatedSize += barSize;
    }
    this.size = calculatedSize;
    if (bars.isEmpty()) {
      bars.add(new Bar(barEpsilon, window));
    }
  }
288978
public void removeHandler(Handler handler) throws SecurityException {
        checkPermission();
        if (handler == null) {
            return;
        }
        handlers.remove(handler);
    }
1080870
private void purgeHandle(String handle) {
        write.lock();
        try {
            kamMap.remove(handle);

            Set<Entry<FilteredKAMKey, String>> entries = fltrdMap.entrySet();
            Iterator<Entry<FilteredKAMKey, String>> iter = entries.iterator();
            while (iter.hasNext()) {
                Entry<FilteredKAMKey, String> next = iter.next();
                if (handle.equals(next.getValue())) {
                    iter.remove();
                }
            }

            Set<Entry<KamInfo, String>> entries2 = unfltrdMap.entrySet();
            Iterator<Entry<KamInfo, String>> iter2 = entries2.iterator();
            while (iter2.hasNext()) {
                Entry<KamInfo, String> next = iter2.next();
                if (handle.equals(next.getValue())) {
                    iter2.remove();
                }
            }
        } finally {
            write.unlock();
        }
    }
962598
@Override
    public final void expirerStop()
    {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(this, tc, "expirerStop");

        _expirer.stop();

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(this, tc, "expirerStop");
    }
739384
public void removeHandler() {

        clearShowing();
        if (m_overHandlerRegistration != null) {
            m_overHandlerRegistration.removeHandler();
            m_overHandlerRegistration = null;
        }
        m_target = null;
    }
949564
private void cleanup() {
		CacheEntry oldest = null;
		_count = 0;

		// Cleanup obsolete entries and find the oldest
		for (Map.Entry<String, CacheEntry> e : _cache.entrySet()) {
			String key = e.getKey();
			CacheEntry entry = e.getValue();
			// Remove obsolete entry
			if (entry.isExpired()) {
				_cache.remove(key);
			}
			// Count the remaining entry
			else {
				_count++;
				if (oldest == null || oldest.getExpiration() > entry.getExpiration())
					oldest = entry;
			}
		}

		// Remove the oldest if cache size exceeded maximum
		if (_count > _maxSize && oldest != null) {
			_cache.remove(oldest.getKey());
			_count--;
		}
	}
1252444
private void cleanupCachedState() {
    int total = 0;
    int expired = 0;
    Iterator<Map.Entry<Id, Object>> it = state.entrySet().iterator();
    while (it.hasNext()) {
      ++total;
      Map.Entry<Id, Object> entry = it.next();
      Object obj = entry.getValue();
      if (obj instanceof Meter && ((Meter) obj).hasExpired()) {
        ++expired;
        it.remove();
      }
    }
    logger.debug("removed {} expired entries from cache out of {} total", expired, total);
  }