This method simply removes a Browser Session from our list. It is generally
called by the Browser Session as it is closing down.

@param browser
498995
void removeBrowserSession(BrowserSessionImpl browser)
    {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(tc, "removeBrowserSession", browser);

        synchronized (_browsers)
        {
            _browsers.remove(browser);
        }
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(tc, "removeBrowserSession");
    }
950191
public synchronized void onRemovedFromList(ObservableList list, Object value) {
        if (!configuration.isUseGc()) {
            return;
        }
        removeReferenceAndCheckForGC(list, value);
    }
1283472
@Override
    public void close(int requestNumber) {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(this, tc, "close", "" + requestNumber);

        BrowserSession browserSession = mainConsumer.getBrowserSession();
        try {
            browserSession.close();
        } catch (SIException e) {
            //No FFDC code needed
            //Only FFDC if we haven't received a meTerminated event.
            if (!((ConversationState) getConversation().getAttachment()).hasMETerminated()) {
                FFDCFilter.processException(e, CLASS_NAME + ".close",
                                            CommsConstants.CATBROWSECONSUMER_CLOSE_01,
                                            this);
            }

            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
                SibTr.debug(this, tc, e.getMessage(), e);

            StaticCATHelper.sendExceptionToClient(e,
                                                  CommsConstants.CATBROWSECONSUMER_CLOSE_01,
                                                  getConversation(), requestNumber);
        }

        try {
            getConversation().send(poolManager.allocate(),
                                   JFapChannelConstants.SEG_CLOSE_CONSUMER_SESS_R,
                                   requestNumber,
                                   Conversation.PRIORITY_LOWEST,
                                   true,
                                   ThrottlingPolicy.BLOCK_THREAD,
                                   null);
        } catch (SIException e) {
            FFDCFilter.processException(e, CLASS_NAME + ".close",
                                        CommsConstants.CATBROWSECONSUMER_CLOSE_02,
                                        this);

            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
                SibTr.debug(this, tc, e.getMessage(), e); // d175222

            // Cannot do anything else at this point as a comms exception suggests that the
            // connection is unusable.
        }

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.exit(this, tc, "close");
    }
886888
@Override
  public void removeSession(String sessionId) {
    logger.debug("removeSession({}) in Local DataSource", sessionId);

    if (this.localDataSource.exists(sessionId)) {
      this.localDataSource.removeSession(sessionId);
    }
    else if (!this.localMode && this.existReplicated(sessionId)) {
      // FIXME: remove node.
    }
  }
926982
@Handler(channels = Channel.class)
    public void discard(DiscardSession event) {
        removeSession(event.session().id());
    }
67631
public void free()
    {
        if ((m_mapChildHolders != null) && (m_mapChildHolders.size() > 0))
        {
            Utility.getLogger().info("Not all sub-sessions freed by client - I will free them");
            synchronized (this)
            {
                Object[] keys = m_mapChildHolders.keySet().toArray(); // Since these are removed on free
                for (Object strID : keys)
                {
                    BaseHolder baseHolder = (BaseHolder)m_mapChildHolders.get(strID);
                    baseHolder.free();  // Should be removed from collection.
                }
                m_mapChildHolders.clear();
            }
        }
        m_mapChildHolders = null;
        if (m_parentHolder != null)
            m_parentHolder.remove(this);
        m_parentHolder = null;
        m_remoteObject = null;
    }
850455
@Override
    public void removeEventListener(EventListener listener) {
        if (listener instanceof SessionListener) {
            sessionListeners.remove(listener);
        }
        if (listener instanceof SessionAttributeListener) {
            sessionAttributeListeners.remove(listener);
        }
    }
148031
public void expireSession(PrimaryBackupSession session) {
    if (sessions.remove(session.sessionId().id()) != null) {
      session.expire();
      listeners.forEach(l -> l.onExpire(session));
    }
  }
967327
public static void clearSession(HttpServletRequest req) {
		SecurityContextHolder.clearContext();
		if (req != null) {
			HttpSession session = req.getSession(false);
			if (session != null) {
				session.invalidate();
			}
		}
	}
658545
protected final void unregisterBrowser( AbstractQueueBrowser browserToRemove )
    {
        if (browsersMap.remove(browserToRemove.getId()) == null)
            log.warn("Unknown browser : "+browserToRemove);
    }
1273215
public synchronized void removeSession(Endpoint ep, SessionExt sess) {
        Class<?> cl = ep.getClass();

        if (cl.equals(AnnotatedEndpoint.class)) {
            AnnotatedEndpoint ae = (AnnotatedEndpoint) ep;
            cl = ae.getServerEndpointClass();
        }

        // Always try to remove http session if we can.
        String id = sess.getSessionImpl().getHttpSessionID();
        if (id != null) {
            httpSessionMap.remove(id);
        }

        // find the session array for the given endpoint
        ArrayList<Session> sa = endpointSessionMap.get(cl);

        // nothing to remove if we don't have a session
        if (sa == null) {
            return;
        }

        // remove the new session from the list for this endpoint
        sa.remove(sess);

        // put the updated list back into the Map
        endpointSessionMap.put(cl, sa);

        if (tc.isDebugEnabled()) {
            Tr.debug(tc, "removed session of: " + sess.getId() + "  from endpoint class of: " + cl.getName() + " in endpointmanager of: " + this.hashCode());
        }
    }
26580
public void stop() {
        if (isStarted()) {
            log.info("Stopping browser " + webDriver.getCurrentUrl());

            try {
                log.info("Trying to close the browser " + webDriver + " ...");
                webDriver.quit();
            } catch (UnreachableBrowserException e) {
                // It happens for Firefox. It's ok: browser is already closed.
                log.warn("Browser is unreachable", e);
            } catch (WebDriverException e) {
                log.error("Failed to close browser", e);
            }

            webDriver = null;
        } else {
            log.warn("Browser already stopped");
        }
    }
389456
public void destroy( HttpServletRequest request )
    {
        StorageHandler sh = Handlers.get( getServletContext() ).getStorageHandler();
        HttpServletRequest unwrappedRequest = PageFlowUtils.unwrapMultipart( request );
        RequestContext rc = new RequestContext( unwrappedRequest, null );
        String attrName = ScopedServletUtils.getScopedSessionAttrName( JPF_STACK_ATTR, unwrappedRequest );
        
        sh.removeAttribute( rc, attrName );
    }
579612
def close_session(self):
        
        with self._graph.as_default():
            self._sess.close()
            self._sess = None
231603
protected void destroyApplicationSession(final HttpServletRequest request, final HttpServletResponse response) {
        LOGGER.trace("Destroying application session");
        val context = new J2EContext(request, response, new J2ESessionStore());
        val manager = new ProfileManager<>(context, context.getSessionStore());
        manager.logout();

        val session = request.getSession(false);
        if (session != null) {
            val requestedUrl = session.getAttribute(Pac4jConstants.REQUESTED_URL);
            session.invalidate();
            if (requestedUrl != null && !requestedUrl.equals(StringUtils.EMPTY)) {
                request.getSession(true).setAttribute(Pac4jConstants.REQUESTED_URL, requestedUrl);
            }
        }
    }
1872
protected void clearSession (PresentsSession session)
    {
        // remove the session from the username map
        PresentsSession rc;
        synchronized (_usermap) {
            rc = _usermap.remove(session.getAuthName());
        }

        // sanity check just because we can
        if (rc == null) {
            log.info("Cleared session: unregistered!", "session", session);
        } else if (rc != session) {
            log.info("Cleared session: multiple!", "s1", rc, "s2", session);
        } else {
            log.info("Cleared session", "session", session);
        }
    }
1157086
private void closeSession(){
        if(LOGGER.isDebugEnabled()){
            LOGGER.debug("Close the session, sessionId=" + session.id + ", timeOut=" + session.timeOut);
        }
        if(! closing && getStatus().isConnected()){
            closing = true;
            if(getStatus().isAlive()){
                setStatus(ConnectionStatus.NOT_CONNECTED);
            }
            cleanupSession();
            closing = false;
        }
    }