Clean up when state machine is being destructed
548806
def state_machine_destruction(self, model, prop_name, info):
        
        if self.model is model:  # only used for the state machine destruction case
            self.canvas.get_view_for_model(self.root_state_m).remove()
1232861
public function cleanupCollapsedStatesInUC()
    {
        $backendUser = $this->getBackendUser();
        if (is_array($backendUser->uc['moduleData']['page']['gridelementsCollapsedColumns'])) {
            $collapsedGridelementColumns = $backendUser->uc['moduleData']['page']['gridelementsCollapsedColumns'];
            foreach ($collapsedGridelementColumns as $item => $collapsed) {
                if (empty($collapsed)) {
                    unset($collapsedGridelementColumns[$item]);
                }
            }
            $backendUser->uc['moduleData']['page']['gridelementsCollapsedColumns'] = $collapsedGridelementColumns;
            $backendUser->writeUC($backendUser->uc);
        }
    }
365421
def state_machines_del_notification(self, model, prop_name, info):
        
        if info['method_name'] == '__delitem__':
            state_machine_m = info["result"]
            try:
                self.relieve_model(state_machine_m)
            except KeyError:
                pass
            self.clean_up_tabs()
789399
private synchronized void expungeStaleEntries()
    {
        if (size == 0) return;
        Object r;
        while ((r = queue.poll()) != null)
        {
            Entry e = (Entry) r;
            unlink(e);
            int h = e.hash;
            int i = indexFor(h, table.length);

            Entry prev = table[i];
            Entry p = prev;
            while (p != null)
            {
                Entry next = p.next;
                if (p == e)
                {
                    if (prev == e)
                        table[i] = next;
                    else
                        prev.next = next;
                    e.next = null;  // Help GC
                    size--;
                    break;
                }
                prev = p;
                p = next;
            }
        }
    }
542142
function() {
		gui.Plugin.prototype.ondestruct.call(this);
		gui.Object.each(this._trackedtypes, function(type, list) {
			list.slice().forEach(function(checks) {
				this._cleanup(type, checks);
			}, this);
		}, this);
	}
895957
private void cleanUpAction() {

        try {
            m_model.deleteDescriptorIfNecessary();
        } catch (CmsException e) {
            LOG.error(m_messages.key(Messages.ERR_DELETING_DESCRIPTOR_0), e);
        }
        // unlock resource
        m_model.unlock();
    }
948544
def resetState(self):
        
        self.extend(self._hidden)
        del self._hidden[:]
        del self._states[:]
1074988
public void deleteStates(Collection<MutableState> statesToDelete) {
    if (statesToDelete.isEmpty()) {
      return;
    }
    for (MutableState state : statesToDelete) {
      deleteState(state);
    }
    remapStateIds();
  }
1051308
def clean_up(self):
        '''  '''
        self.socket.close()
        for h in self.capture_handlers:
            h['logger'].close()
657063
def cleanup(self):
        """"""
        for _id, shard in self._shards.items():
            if shard.get('isServer', False):
                Servers().remove(shard['_id'])
            if shard.get('isReplicaSet', False):
                ReplicaSets().remove(shard['_id'])

        for mongos in self._routers:
            Servers().remove(mongos)

        for config_id in self._configsvrs:
            self.configdb_singleton.remove(config_id)

        self._configsvrs = []
        self._routers = []
        self._shards = {}
729519
private void tearDownShiro()
  {
    try
    {
      SecurityManager securityManager = SecurityUtils.getSecurityManager();

      LifecycleUtils.destroy(securityManager);
      ThreadContext.unbindSecurityManager();
      ThreadContext.unbindSubject();
      ThreadContext.remove();
    }
    catch (UnavailableSecurityManagerException e)
    {

      // we don't care about this when cleaning up the test environment
      // (for example, maybe the subclass is a unit test and it didn't
      // need a SecurityManager instance because it was using only mock Subject instances)
    }

    SecurityUtils.setSecurityManager(null);
  }
1365811
private void clearState() {

        if (m_state != null) {
            ParamState state = m_state;
            m_state = null;
            state.undoChanges();
        }
    }
638209
public void cleanup() {
		long currentTime = System.currentTimeMillis();

		// remove entries which have exceeded their time to live
		cachedExecutionGraphs.values().removeIf(
			(ExecutionGraphEntry entry) -> currentTime >= entry.getTTL());
	}
831356
function () {
                stateMemory.discarded = [];
                if (this._isIE7OrLess) {
                    stateMemory.states = [stateMemory.states[this._currentPos]];
                    return;
                }
                var states = stateMemory.states;
                var expirationTime = ((new Date()).getTime() - this.EXPIRATION_TIME * 1000) + "";
                for (var i = 0; i < states.length; i++) {
                    if (states[i].id > expirationTime) {
                        break;
                    }
                }
                states.splice(0, i);
            }
592042
protected function cleanup()
    {
        // if $this->fs is an object, the Filesystem has been used, clean it up.
        if (is_object($this->fs)) {
            if ($this->fs->isDirectory($this->tempPath)) {
                $this->fs->deleteDirectory($this->tempPath, false);
            }
        }
    }
1260127
def _cleanup(self):
        '''
        
        '''
        self._declare_cb = None
        self._bind_cb = None
        self._unbind_cb = None
        self._delete_cb = None
        self._purge_cb = None
        super(QueueClass, self)._cleanup()
1163729
def teardown(self):
        '''
        
        '''
        if self.controller:
            self.controller.teardown()
        for monitor in self.monitors:
            monitor.teardown()