Deals with all of the processing when an occupant leaves.
549284
public void entryRemoved (EntryRemovedEvent<OccupantInfo> event)
    {
        // bail if this isn't for the OCCUPANT_INFO field
        if (!event.getName().equals(PlaceObject.OCCUPANT_INFO)) {
            return;
        }

        // let the occupant observers know what's up
        final OccupantInfo oinfo = event.getOldEntry();
        _observers.apply(new ObserverList.ObserverOp<OccupantObserver>() {
            public boolean apply (OccupantObserver observer) {
                observer.occupantLeft(oinfo);
                return true;
            }
        });
    }
1120
protected function processOfferAfterDelete()
    {
        $obOfferList = $this->obElement->offer;
        if ($obOfferList->isEmpty()) {
            return;
        }

        foreach ($obOfferList as $obOffer) {
            $obOffer->active = false;
            $obOffer->save();
        }
    }
1194880
public function onClose()
    {
        if ($this->realm !== null) {
            // only send the leave metaevent if we actually made it into the realm
            if ($this->isAuthenticated()) {
                // metaevent
                $this->getRealm()->publishMeta('wamp.metaevent.session.on_leave', [$this->getMetaInfo()]);
            }
            $this->dispatcher->dispatch('LeaveRealm', new LeaveRealmEvent($this->realm, $this));

            $this->realm = null;
        }
    }
1050522
protected void cleanup() {
		int closed = 0;
		SendBuffer buffer;
		synchronized (buffers) {
			int buffersToClose = buffers.size() - maxConnections;
			if (buffersToClose < 1) {
				return;
			}
			Iterator<SendBuffer> i = buffers.values().iterator();
			while (i.hasNext()) {
				buffer = i.next();
				if (buffer.tryToClose()) {
					i.remove();
					closed++;
					if (closed >= buffersToClose) {
						return;
					}
				}
			}
		}
	}
682368
public void finish() {
        if (logListenerCommandShell != null) {
            logListenerCommandShell.cancel();
        }
        for (ScreenshotProcessor screenshotProcessor : processors) {
            screenshotProcessor.finish();
        }
    }
1208349
protected TaskBase endOfProcessDetected(ProcessInstance processInstance, Audit currentAudit) {
		TaskBase ret = null;
		TaskBase currentTask = getCurrentTask(processInstance);
		ProcessInstanceUtils.clearQueue(processInstance, TaskStatus.DONE);
		currentAudit.setStatus(TaskStatus.DONE);
		// End of process can mean just the end of a handler process.
		{
			List<Audit> audits = findHandlerTasks(processInstance);
			for (Audit audit : audits) {
				TaskBase taskBase = getTask(audit);
				audit.setHandler(false);
				if (taskBase instanceof TaskTry) {
					TaskTry taskTry = (TaskTry)taskBase;
					if (taskTry.getTimeoutValue() > -1) {
						// we ended a handler that had a timeout.
						// That means we need to cancel the timeout.
						getWorkflowDAO().removeDeferredEvent(processInstance,taskTry);
					}
					TaskBase nextTask = taskTry.getNextTask(processInstance);
					nextTask.loadTask(processInstance);
				}
				if (taskBase instanceof TaskIf) {
					TaskIf taskIf = (TaskIf)taskBase;
					TaskBase nextTask = taskIf.getNextTask(processInstance);
					nextTask.loadTask(processInstance);
				}
				ret = getCurrentTask(processInstance);
				break;
			}

		}
		// If this is a subprocess then tickle the parent.
		tickleParentProcess(processInstance,TaskStatus.DONE);
		if (ret == currentTask) {
			processInstance.setStatus(TaskStatus.DONE);
		}
		getWorkflowDAO().mergeProcessInstance(processInstance);
		getWorkflowDAO().flush();
		getWorkflowDAO().refreshProcessInstance(processInstance);
		return ret;
	}
547589
private function cleanupDeadProcesses()
    {
        $processes = ezpContentPublishingProcess::fetchProcesses( ezpContentPublishingProcess::STATUS_WORKING );
        foreach( $processes as $process )
        {
            if ( !$process->isAlive() )
            {
                $process->reset();
            }
        }
    }
792162
def cleanup():
    
    _log.debug("P4P atexit begins")
    # clean provider registry
    from .server import clearProviders, _cleanup_servers
    clearProviders()

    # close client contexts
    from .client.raw import _cleanup_contexts
    _cleanup_contexts()

    # stop servers
    _cleanup_servers()

    # shutdown default work queue
    from .util import _defaultWorkQueue
    _defaultWorkQueue.stop()
    _log.debug("P4P atexit completes")
1329111
def _clean(self):
        """"""
        if self._workers:
            for w in self._workers:
                if w.is_finished():
                    self._workers.remove(w)
        else:
            self._current_worker = None
            self._timer.stop()
871255
public function cleanUp()
    {
        // create a separate queue for each priority
        foreach (PriorityKeys::getAll() as $priorityKey) {
            $this->workers[$this->uniqueWorkerName($priorityKey)]->stop();
        }
    }
1079974
protected function _finish()
    {
        global $classLoader; // composer's class loader instance
        snapshot();
        Plugin::dropCache();
        // trick: makes plugin visible to AcoManager
        $classLoader->addPsr4($this->_plugin['name'] . "\\", normalizePath(ROOT . "/plugins/{$this->_plugin['name']}/src"), true);
        AcoManager::buildAcos($this->_plugin['name']);
        $this->_reset();
    }
372689
def cleanup(self):
        
        if self.transport:
            self.transport.close()
            self.transport = None
        if self.task:
            self.task.cancel()
            self.task = None
1232177
synchronized void cleanUp() {

        updateAccessCounts();

        int                          removeCount = size() / 2;
        int accessTarget = getAccessCountCeiling(removeCount, removeCount / 8);
        BaseHashMap.BaseHashIterator it          = new BaseHashIterator();
        int                          savecount   = 0;

        for (; it.hasNext(); ) {
            CachedObject r = (CachedObject) it.next();

            if (it.getAccessCount() <= accessTarget) {
                synchronized (r) {
                    if (!r.isKeepInMemory()) {
                        r.setInMemory(false);

                        if (r.hasChanged()) {
                            rowTable[savecount++] = r;
                        }

                        it.remove();

                        cacheBytesLength -= r.getStorageSize();

                        removeCount--;
                    }
                }
            }
        }

        if (removeCount > 50) {
            it = new BaseHashIterator();

            for (; removeCount >= 0 && it.hasNext(); ) {
                CachedObject r = (CachedObject) it.next();

                if (!r.isKeepInMemory()) {
                    r.setInMemory(false);

                    if (r.hasChanged()) {
                        rowTable[savecount++] = r;
                    }

                    it.remove();

                    cacheBytesLength -= r.getStorageSize();

                    removeCount--;
                }
            }
        }

        super.setAccessCountFloor(accessTarget);
        saveRows(savecount);
    }
32115
function handleExit (canCancel, signal, code) {
	var i = 0,
		sub;

	while ((sub = subs[i++])) {
		if (sub[0].call(sub[1], canCancel, signal, code) === false && canCancel) {
			return;
		}
	}

	if (canCancel) {
		process.exit(code);
	}
}
185251
function resetWorker() {
    sigqueue = [];
    mastersigs.forEach(process.removeAllListeners.bind(process));
    process.removeAllListeners('exit');
    process.env.TIAMAT = '1';
  }
554265
static function cleanup()
    {
        $availableHandlers = eZNotificationEventFilter::availableHandlers();

        $db = eZDB::instance();
        $db->begin();
        foreach( $availableHandlers as $handler )
        {
            if ( $handler !== false )
            {
                $handler->cleanup();
            }
        }
        $db->commit();
    }
186627
private void cleanup() {
        long traceId = LoggerHelpers.traceEnterWithContext(log, this.traceObjectId, "cleanup");
        val toRemove = this.processors.values().stream()
                                      .map(this::closeIfNecessary)
                                      .filter(ProcessorCollection::isClosed)
                                      .map(ProcessorCollection::getId)
                                      .collect(Collectors.toList());
        toRemove.forEach(this.processors::remove);
        LoggerHelpers.traceLeave(log, this.traceObjectId, "cleanup", traceId, toRemove.size());
    }