Remove all contexts that are expired.
@param contexts all contexts currently in memory
512552
protected void removeExpired(Map<Integer, Context> contexts) {
        Iterator<Context> contextsIter = contexts.values().iterator();
        while (contextsIter.hasNext()) {
            Context context = contextsIter.next();
            if (context.completeMoment != null
                    && System.currentTimeMillis() - context.completeMoment > contextTimeout) {
                contextsIter.remove();
            }
        }
    }
200682
public static void clearContextPath ()
  {
    if (s_sServletContextPath != null)
    {
      if (LOGGER.isInfoEnabled () && !isSilentMode ())
        LOGGER.info ("The servlet context path '" + s_sServletContextPath + "' was cleared!");
      s_sServletContextPath = null;
    }
    if (s_sCustomContextPath != null)
    {
      if (LOGGER.isInfoEnabled () && !isSilentMode ())
        LOGGER.info ("The custom servlet context path '" + s_sCustomContextPath + "' was cleared!");
      s_sCustomContextPath = null;
    }
  }
188226
protected void deactivate(ComponentContext context) {
        securityServiceRef.deactivate(context);
        unauthSubjectServiceRef.deactivate(context);
        authServiceRef.deactivate(context);
        credServiceRef.deactivate(context);

    }
922085
private void removeContext(final String contextID) {

    synchronized (this.contextStack) {

      if (!contextID.equals(this.contextStack.peek().getIdentifier())) {
        throw new IllegalStateException("Trying to close context with id `" + contextID +
            "`. But the top context has id `" +
            this.contextStack.peek().getIdentifier() + "`");
      }

      this.contextStack.peek().close();
      if (this.contextStack.size() > 1) {
        /* We did not close the root context. Therefore, we need to inform the
         * driver explicitly that this context is closed. The root context notification
         * is implicit in the Evaluator close/done notification.
         */
        this.heartBeatManager.sendHeartbeat(); // Ensure Driver gets notified of context DONE state
      }
      this.contextStack.pop();
      /*
      * At this moment, the Evaluator is actually idle and has some time till the Driver sends it additional work.
      * Also, a potentially large object graph just became orphaned: all the objects instantiated by the context
      * and service injectors can now be garbage collected. So GC call is justified.
      * */
      System.gc();
    }
  }
135781
def delete_contexts(self, context_id_list):
        
        for c_id in context_id_list:
            if c_id in self._contexts:
                del self._contexts[c_id]
732789
void close() {
    final ContextStop contextStop = new ContextStopImpl(this.identifier);
    for (final EventHandler<ContextStop> stopHandler : this.contextStopHandlers) {
      stopHandler.onNext(contextStop);
    }
  }
577493
static void clearSharedPreferences(Context context) {
        SharedPreferences.Editor editor = getPreferencesEditor(context);
        editor.remove(PREF_KEY_INSTALL_DATE);
        editor.remove(PREF_KEY_LAUNCH_TIMES);
        editor.apply();
    }
733746
public static void removeAllCookies(Context context) {
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
            removeAllCookiesV21();
        } else {
            removeAllCookiesV14(context.getApplicationContext());
        }
    }
815344
public static void endContext(ControlContainerContext context)
    {
        Stack<ControlContainerContext> contextStack = _threadContexts.get();
        if (contextStack == null || contextStack.size() == 0)
            throw new IllegalStateException("No context started for current thread");

        if (contextStack.peek() != context)
            throw new IllegalStateException("Context is not the current active context");

        contextStack.pop();
    }
662162
public void unsetResourceAdaptorContext() {
        resourceAdaptorContext = null;
        tracer = null;
        eventIdCache = null;
        eventIDFilter = null;
        sleeEndpoint = null;
        eventLookup = null;
        requestLock = null;
        httpRaSbbinterface = null;
    }
1173073
public void clearExpired() {
		Iterator keys = cacheLineTable.keySet().iterator();

		while (keys.hasNext()) {
			Object key = keys.next();

			if (hasExpired(key)) {
				removeObject(key);
			}
		}
	}
411443
public static void removeAll(final Iterable<String> keys) {
        if (contextMap instanceof CleanableThreadContextMap) {
            ((CleanableThreadContextMap) contextMap).removeAll(keys);
        } else if (contextMap instanceof DefaultThreadContextMap) {
            ((DefaultThreadContextMap) contextMap).removeAll(keys);
        } else {
            for (final String key : keys) {
                contextMap.remove(key);
            }
        }
    }
340425
protected void cleanupStaleContexts(final Set<?> rowIds) {
		RepeaterModel model = getOrCreateComponentModel();

		if (model.rowContextMap != null) {
			for (Iterator<Map.Entry<Object, SubUIContext>> i = model.rowContextMap.entrySet().
					iterator(); i.hasNext();) {
				Map.Entry<Object, SubUIContext> entry = i.next();
				Object rowId = entry.getKey();

				if (!rowIds.contains(rowId)) {
					i.remove();
				}
			}
			if (model.rowContextMap.isEmpty()) {
				model.rowContextMap = null;
			}
		}
	}
702927
public void performClear(Transaction tx, Resource... contexts) {
        if(notNull(contexts)) {
            for (int i = 0; i < contexts.length; i++) {
                if (notNull(contexts[i])) {
                    graphManager.delete(contexts[i].stringValue(), tx);
                } else {
                    graphManager.delete(DEFAULT_GRAPH_URI, tx);
                }
            }
        }else{
            graphManager.delete(DEFAULT_GRAPH_URI, tx);
        }
    }
958138
@Override
	public synchronized void deleteAllDataForContext(int contextId) throws DatabaseException {
    	SqlPreparedStatementWrapper psDeleteAllDataForContext = null;
    	try {
        	psDeleteAllDataForContext = DbSQL.getSingleton().getPreparedStatement("context.ps.deletealldataforcontext");
			psDeleteAllDataForContext.getPs().setInt(1, contextId);
			psDeleteAllDataForContext.getPs().executeUpdate();
		} catch (SQLException e) {
			throw new DatabaseException(e);
		} finally {
			DbSQL.getSingleton().releasePreparedStatement(psDeleteAllDataForContext);
		}
    }
465982
@Override
	public void unbind(Object context) {
		if (m_validationSession != null && context instanceof ValidationObject) {
	        m_validationSession.unbind((ValidationObject) context);
		}
	}
405140
public static void popContext() {
        Context context = LOCAL.get();
        if (context != null) {
            Context parent = context.getParent();
            if (parent != null) {
                LOCAL.set(parent);
            } else {
                LOCAL.remove();
            }
        }
    }