Determines if a cleanup would actually remove any data in this SSTable based
on a set of owned ranges.
495587
static boolean needsCleanup(SSTableReader sstable, Collection<Range<Token>> ownedRanges)
    {
        assert !ownedRanges.isEmpty(); // cleanup checks for this

        // unwrap and sort the ranges by LHS token
        List<Range<Token>> sortedRanges = Range.normalize(ownedRanges);

        // see if there are any keys LTE the token for the start of the first range
        // (token range ownership is exclusive on the LHS.)
        Range<Token> firstRange = sortedRanges.get(0);
        if (sstable.first.getToken().compareTo(firstRange.left) <= 0)
            return true;

        // then, iterate over all owned ranges and see if the next key beyond the end of the owned
        // range falls before the start of the next range
        for (int i = 0; i < sortedRanges.size(); i++)
        {
            Range<Token> range = sortedRanges.get(i);
            if (range.right.isMinimum())
            {
                // we split a wrapping range and this is the second half.
                // there can't be any keys beyond this (and this is the last range)
                return false;
            }

            DecoratedKey firstBeyondRange = sstable.firstKeyBeyond(range.right.maxKeyBound());
            if (firstBeyondRange == null)
            {
                // we ran off the end of the sstable looking for the next key; we don't need to check any more ranges
                return false;
            }

            if (i == (sortedRanges.size() - 1))
            {
                // we're at the last range and we found a key beyond the end of the range
                return true;
            }

            Range<Token> nextRange = sortedRanges.get(i + 1);
            if (!nextRange.contains(firstBeyondRange.getToken()))
            {
                // we found a key in between the owned ranges
                return true;
            }
        }

        return false;
    }
1195143
public function cleanup_tables()
    {

        logger()->info('Performing table maintenance');

        // Prune the failed jobs table
        FailedJob::where('id', '<', (FailedJob::max('id') - 100))->delete();

        // Prune the server statuses older than a week.
        ServerStatus::where('created_at', '<', carbon('now')->subWeek(1))->delete();

        // Prune ESI statuses older than a week
        EsiStatus::where('created_at', '<', carbon('now')->subWeek(1))->delete();

        // Remove groups with no users
        Group::doesntHave('users')->delete();
    }
504839
public boolean remove(SpdData data) {
        if (data == null)
            return false;
        if (data instanceof SpdStat) {
            return super.remove(data);
        } else {
            return false;
        }
    }
113143
private synchronized void checkCache()
    {
        Object[] pTables = m_setTableCacheList.toArray();
        for (Object objTable : pTables)
        {
            PTable pTable = (PTable)objTable;
            if (pTable.addPTableOwner(null) == 1)
            { // Not currently being used is a candidate for flushing from the cache.
                long lTimeLastUsed = pTable.getLastUsed();
                long lTimeCurrent = System.currentTimeMillis();
                if ((lTimeCurrent - lTimeLastUsed) > (this.getCacheMinutes() * 60 * 1000))
                {
                    pTable.removePTableOwner(this, true);
                    m_setTableCacheList.remove(pTable);
                }
            }
        }
    }
989947
private void cleanup() {
        StatsDataReference ref = null;
        while ((ref = (StatsDataReference) statisticsReferenceQueue.poll()) != null) {
            StatsData oldStats = null;
            StatsData updatedStats = null;
            do {
                oldStats = terminatedThreadStats.get();
                updatedStats = aggregateStats(oldStats, ref.statsData);
            } while (!terminatedThreadStats.compareAndSet(oldStats, updatedStats));
            allReferences.remove(ref);
        }
    }
913419
public void cleanup() {
        state = null;
        if (headerBuffer != null) {
            bufferPool.deallocate(headerBuffer);
        }
        if (dataBuffer != null) {
            bufferPool.deallocate(dataBuffer);
        }
    }
661295
def has_dirty_state_machine(self):
        
        for sm in self.state_machines.values():
            if sm.marked_dirty:
                return True
        return False
1016904
public synchronized boolean isDeleteInProgress()
    {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
        {
            SibTr.entry(tc, "isDeleteInProgress");
            SibTr.exit(tc, "isDeleteInProgress", Boolean.valueOf(_deleteInProgress));
        }

        return _deleteInProgress;
    }
1345604
public boolean isHit(Range target) {
		for (Range range : getRanges()) {
			if (range.hasIntersection(target)) {
				return true;
			}
		}
		return false;
	}
204723
public function purgeExpired()
    {

        if ($this->sqlInitialized()) {
            if ($this->sql) {
                if ($this->sql->query("
                    DELETE
                        FROM `{$this->table}`
                        WHERE `expire` < NOW()
                ")) {
                    return true;
                }
            }
        }
        return false;
    }
1171914
private function deleteOldSessions()
    {
        // 2% chance of kicking idle sessions
        if (mt_rand(0, 49)) {
            return false;
        }

        $sessions = new UsersSessionEntityRepository();
        $sessions->setOnlyOutdated();
        $sessions->deleteObjectCollection();

        return true;
    }
1231282
int removeSessionToSessions(Session session, Collection<Session> sessions) {
		if (sessions != null) {
			if (sessions.remove(session)) {
				return 1;
			}
		}
		return 0;
	}
413394
private boolean pruneData(ThroughputDistribution priorStats, double forecast) {
        boolean prune = false;

        // if forecast tput is much greater or much smaller than priorStats, we suspect
        // priorStats is no longer relevant, so prune it
        double tputRatio = forecast / priorStats.getMovingAverage();
        if (tputRatio > tputRatioPruneLevel || tputRatio < (1 / tputRatioPruneLevel)) {
            prune = true;
        } else {
            // age & reliability (represented by standard deviation) check
            int age = controllerCycle - priorStats.getLastUpdate();
            double variability = (priorStats.getStddev() / priorStats.getMovingAverage());
            if (age * variability > dataAgePruneLevel)
                prune = true;
        }

        return prune;
    }
410390
public function removeAllowed ($range)
	{
		
		$formatted	= $this->formatRange ($range);
		
		if (!$formatted)
		{
			return FALSE;
		}
		
		unset ($this->allowIPs[$formatted[0]]);
		return TRUE;
		
	}
205300
private void cleanup() {
    if (operation instanceof Command && log.isOpen()) {
      try {
        log.release(index);
      } catch (IllegalStateException e) {
      }
    }

    session.release();

    index = 0;
    session = null;
    instant = null;
    operation = null;

    pool.release(this);
  }
276937
def maybe_clean(self):
        """"""

        now = time.time()
        if self.next_cleaning <= now:
            keys_to_delete = []
            for (k, v) in self.data.iteritems():
                if v.expiration <= now:
                    keys_to_delete.append(k)
            for k in keys_to_delete:
                del self.data[k]
            now = time.time()
            self.next_cleaning = now + self.cleaning_interval
143989
private void sweepExpiredNonces() {

        // Do not sweep until enough time has elapsed since the last sweep
        long currentTime = System.currentTimeMillis();
        if (currentTime - lastSweep < SWEEP_INTERVAL)
            return;

        // Record time of sweep
        lastSweep = currentTime;

        // For each stored nonce
        Iterator<Map.Entry<String, Long>> entries = nonces.entrySet().iterator();
        while (entries.hasNext()) {

            // Remove all entries which have expired
            Map.Entry<String, Long> current = entries.next();
            if (current.getValue() <= System.currentTimeMillis())
                entries.remove();

        }

    }