If needed, destroy the remaining conversation contexts after an HTTP session was invalidated within the current request.

@param request
550557
private void processDestructionQueue(HttpServletRequest request) {
        Object contextsAttribute = request.getAttribute(DESTRUCTION_QUEUE_ATTRIBUTE_NAME);
        if (contextsAttribute instanceof Map) {
            Map<String, List<ContextualInstance<?>>> contexts = cast(contextsAttribute);
            synchronized (contexts) {
                FastEvent<String> beforeDestroyedEvent = FastEvent.of(String.class, beanManager, BeforeDestroyed.Literal.CONVERSATION);
                FastEvent<String> destroyedEvent = FastEvent.of(String.class, beanManager, Destroyed.Literal.CONVERSATION);
                for (Iterator<Entry<String, List<ContextualInstance<?>>>> iterator = contexts.entrySet().iterator(); iterator.hasNext();) {
                    Entry<String, List<ContextualInstance<?>>> entry = iterator.next();
                    beforeDestroyedEvent.fire(entry.getKey());
                    for (ContextualInstance<?> contextualInstance : entry.getValue()) {
                        destroyContextualInstance(contextualInstance);
                    }
                    // Note that for the attached/current conversation we fire the destroyed event twice because we can't reliably identify such a conversation
                    destroyedEvent.fire(entry.getKey());
                    iterator.remove();
                }
            }
        }
    }
274974
public void destroy(DestroyRequest request) {
    call(
      new PostRequest(path("destroy"))
        .setParam("id", request.getId())
        .setParam("organization", request.getOrganization())
        .setMediaType(MediaTypes.JSON)
    ).content();
  }
928788
public static void removeActionForm(ActionMapping mapping, HttpServletRequest request) {
		if (mapping.getAttribute() != null) {
			if ("request".equals(mapping.getScope()))
				request.removeAttribute(mapping.getAttribute());
			else {
				HttpSession session = request.getSession();
				session.removeAttribute(mapping.getAttribute());
				request.removeAttribute(mapping.getAttribute());
			}
		}
	}
1317042
protected function cleanupSession(WebRequest $request)
    {
        $sessionToken = $request->getSessionData('userSessionToken');
        setcookie($sessionToken, 0, time() - 60, '/', '', $request->isSsl());
        
        $oldSessionToken = $request->getSessionData('oldUserSessionToken');
        if ($oldSessionToken != '') {
            setcookie($oldSessionToken, 0, time() - 60, '/', '', $request->isSsl());
        }
    
        $request->deleteSessionData('userUuid');
        $request->deleteSessionData('userSessionToken');
        $request->deleteSessionData('userSessionTokenLifetime');
        $request->deleteSessionData('oldUserSessionToken');
        $request->deleteSessionData('oldUserSessionTokenLifetime');
    }
1242987
public void onSessionDestruction(Request currentRequest, Session session)
	{
		HttpServletResponse response = (HttpServletResponse)httpResponse.get();
		storeSessionDataInCookie(SESSION_TOKEN_KEY, null, response);
		storeSessionDataInCookie(USER_ID_KEY, null, response);
	}
1004242
public void cleanUp(RESTRequest request) {
        //We need to loop through the clients but we don't want to synchronize
        //the entire map, which would block new clients from entering and block existing 
        //clients from continuing their work.  So we iterate and possibly remove by just
        //using the built-in concurrency of ConcurrentHashMap.
        final Iterator<Entry<Integer, ClientNotificationArea>> clients = inboxes.entrySet().iterator();

        while (clients.hasNext()) {
            Entry<Integer, ClientNotificationArea> client = clients.next();

            //Check for time outs
            ClientNotificationArea inbox = client.getValue();
            if (inbox.timedOut()) {
                //cleanup
                inbox.cleanUp(request);

                //Emit the warning
                Tr.warning(tc, "jmx.connector.server.rest.notification.timeout.warning", client.getKey());

                //remove the client inbox from the map (using the Iterator.remove() method)
                clients.remove();
            }
        }

    }
211628
public void unbindEip(UnbindEipRequest request) {
        checkStringNotEmpty(request.getEip(), "eip should not be empty");
        if (Strings.isNullOrEmpty(request.getClientToken())) {
            request.setClientToken(generateDefaultClientToken());
        }
        InternalRequest internalRequest = this.createRequest(request, HttpMethodName.PUT, request.getEip());
        internalRequest.addParameter("unbind", null);
        internalRequest.addParameter(CLIENT_TOKEN_IDENTIFY, request.getClientToken());
        internalRequest.addHeader(Headers.CONTENT_LENGTH, "0");
        internalRequest.addHeader(Headers.CONTENT_TYPE, DEFAULT_CONTENT_TYPE);
        invokeHttpClient(internalRequest, AbstractBceResponse.class);
    }
514718
private function closeSession(Request $request)
    {
        $session = $request->getSession();

        if ($session && $session->isStarted()) {
            $session->save();
        }
    }
575683
void removeSession(JmsSessionImpl sess) {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(this, tc, "removeSession", sess);

        synchronized (stateLock) {
            // Remove the Session
            // Note that this is a synchronized collection.
            boolean res = sessions.remove(sess);

            // Release the ordering context associated with the session
            unusedOrderingContexts.add(sess.getOrderingContext());

            if (!res && TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
                SibTr.debug(this, tc, "session not found in list");
        }

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(this, tc, "removeSession");
    }
157145
public static void removeScopedSessionAttr( String attrName, HttpServletRequest request )
    {
        HttpSession session = request.getSession( false );
        
        if ( session != null )
        {
            session.removeAttribute( getScopedSessionAttrName( attrName, request ) );
        }
    }
1255613
public void end() {
        if (endCallback != null) {
            endCallback.accept(this, context);
        }

        if (currentPrompt != null) {
            currentPrompt.conversationEnded(context);
            currentPrompt = null;
        }

        Extensions.get(context.getBot(), ConversationRegistry.class).removeConversation(this);
        virgin = false;
    }
1156996
@Override
	public void serviceRequest(final Request request) {
		LOG.debug("Before Service Request - Clearing targetable index.");
		UIContext uic = UIContextHolder.getCurrent();

		super.serviceRequest(request);
		// Clear phase scope scratch map
		LOG.debug("After Service Request - Clearing scratch map with phase scope.");
		uic.clearScratchMap();
	}
1175229
<T> void finish(Request<T> request) {
        // Remove from the set of requests currently being processed.
        synchronized (currentRequests) {
            currentRequests.remove(request);
        }
        if (request.shouldCache()) {
            synchronized (waitingRequests) {
                String cacheKey = request.getCacheKey();
                Queue<Request<?>> waitingRequests = this.waitingRequests.remove(cacheKey);
                if (waitingRequests != null) {
                    //todo add queue markers
//                    if (JusLog.DEBUG) {
//                        JusLog.v("Releasing %d waiting requests for cacheKey=%s.",
//                                waitingRequests.size(), cacheKey);
//                    }
                    // Process all queued up requests. They won't be considered as in flight, but
                    // that's not a problem as the cache has been primed by 'request'.
                    cacheQueue.addAll(waitingRequests);
                }
            }
        }
    }
1027194
public static void bind(HttpServletRequest request) {
        if (request != null && threadLocal.get() != null) {
            throw new IllegalStateException("HttpServletRequestHolder.bind() called for a "
                    + "thread that already has a request associated with it. It's likely that the request "
                    + "was not correctly removed from the thread before it is put back into the thread pool.");
        }
        threadLocal.set(request);
    }
1349594
public Observable<Service> removeService(final RemoveServiceRequest request) {
        LOGGER.debug("Got instructed to remove Service {}, from Node {}", request.type(), request.hostname());
        return nodeBy(request.hostname()).removeService(request);
    }
918906
public void deleteStream(DeleteStreamRequest request) {
        checkNotNull(request, "The parameter request should NOT be null.");

        checkStringNotEmpty(request.getDomain(), "Domain should NOT be empty.");
        checkStringNotEmpty(request.getApp(), "App should NOT be empty.");
        checkStringNotEmpty(request.getStream(), "Stream should NOT be empty.");

        InternalRequest internalRequest = createRequest(HttpMethodName.DELETE, request,
                LIVE_DOMAIN, request.getDomain(), LIVE_APP, request.getApp(),
                LIVE_STREAM, request.getStream());
        invokeHttpClient(internalRequest, AbstractBceResponse.class);
    }
917303
public void deleteSecurityGroup(DeleteSecurityGroupRequest request) {
        checkNotNull(request, "request should not be null.");
        checkStringNotEmpty(request.getSecurityGroupId(), "request securityGroupId should not be empty.");
        InternalRequest internalRequest =
                this.createRequest(request, HttpMethodName.DELETE, SECURITYGROUP_PREFIX, request.getSecurityGroupId());
        invokeHttpClient(internalRequest, AbstractBceResponse.class);
    }