/*
(non-Javadoc)

@see
com.google.code.hs4j.network.hs.HandlerCOnnector#addSession(com.google
.code.hs4j.network.core.Session)
505844
public void addSession(Session session) {
		InetSocketAddress remoteSocketAddress = session
				.getRemoteSocketAddress();
		log.warn("Add a session: "
				+ SystemUtils.getRawAddress(remoteSocketAddress) + ":"
				+ remoteSocketAddress.getPort());
		this.sessionList.add(session);
	}
211818
public void sessionDidActivate(ISession session) {
        HttpSession httpsession = (HttpSessionImpl) _adapter.adapt(session);
        HttpSessionEvent event = new HttpSessionEvent(httpsession);

        Enumeration enum1 = session.getAttributeNames();
        String attrName;
        Object attr;
        while (enum1.hasMoreElements()) {
            attrName = (String) enum1.nextElement();
            attr = session.getAttribute(attrName);
            if (attr instanceof HttpSessionActivationListener) {
                ((HttpSessionActivationListener) attr).sessionDidActivate(event);
            }
        }
    }
1195004
public Function<IHTTPSession, Response> addSessionHandler(final String path, final Function<IHTTPSession, Response> value) {
    return customHandlers.put(path, value);
  }
966064
public void addHttpSessionListener(ArrayList al, String j2eeName) {
        if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_CORE.isLoggable(Level.FINE)) {
            LoggingUtil.SESSION_LOGGER_CORE.entering(methodClassName, methodNames[ADD_HTTP_SESSION_LISTENER], "addHttpSessionListener:" + al);
        }
        if (j2eeName != null) {
            addToJ2eeNameList(j2eeName, al.size(), mHttpSessionListenersJ2eeNames);
        }
        synchronized (mHttpSessionListeners) {
            mHttpSessionListeners.addAll(al);
            if (mHttpSessionListeners.size() > 0) {
                sessionListener = true;
                _coreHttpSessionManager.getIStore().setHttpSessionListener(true);
                boolean mIBMSessionListenerImplemented = isIBMSessionListenerImplemented(al); // PQ81248
                if (mIBMSessionListenerImplemented) {
                    wasHttpSessionObserver.setDoesContainIBMSessionListener(true);
                }
            }
        }

        if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_CORE.isLoggable(Level.FINE)) {
            LoggingUtil.SESSION_LOGGER_CORE.exiting(methodClassName, methodNames[ADD_HTTP_SESSION_LISTENER], "addHttpSessionListener:" + al);
        }
    }
22489
@Override
    public Session createSession() throws JMSException {

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
            SibTr.entry(this, tc, "createSession");

        Session session = null;
        try {
            session = createSession(false, Session.AUTO_ACKNOWLEDGE);
        } finally {
            if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
                SibTr.exit(this, tc, "createSession");
        }

        return session;
    }
880768
ServerSessionManager registerConnection(String client, Connection connection) {
    ServerSessionContext session = clients.get(client);
    if (session != null) {
      session.setConnection(connection);
    }
    connections.put(client, connection);
    return this;
  }
626863
public HttpSession newHttpSession(HttpServletRequest request)
    {
        Session session = newSession(request);
        session.setMaxInactiveInterval(_dftMaxIdleSecs);
        synchronized(__allSessions)
        {
            synchronized(this)
            {
              _sessions.put(session.getId(),session);
              __allSessions.add(session.getId(), session);
              if (_sessions.size() > this._maxSessions)
                  this._maxSessions = _sessions.size ();
            }
        }
        
        HttpSessionEvent event=new HttpSessionEvent(session);
        
        for(int i=0;i<_sessionListeners.size();i++)
            ((HttpSessionListener)_sessionListeners.get(i))
            .sessionCreated(event);
        
        if (getCrossContextSessionIDs())
            request.setAttribute(__NEW_SESSION_ID, session.getId());
        return session;
    }
1168261
@Override
  public AppSession getNewSession(String sessionId, Class<? extends AppSession> aClass, ApplicationId applicationId, Object[] args) {
    AppSession appSession = null;

    if (aClass == ServerS6aSession.class) {
      if (sessionId == null) {
        if (args != null && args.length > 0 && args[0] instanceof Request) {
          Request request = (Request) args[0];
          sessionId = request.getSessionId();
        }
        else {
          sessionId = this.sessionFactory.getSessionId();
        }
      }
      IServerS6aSessionData sessionData = (IServerS6aSessionData) this.sessionDataFactory.getAppSessionData(ServerS6aSession.class, sessionId);
      sessionData.setApplicationId(applicationId);
      S6aServerSessionImpl serverSession = new S6aServerSessionImpl(sessionData, getMessageFactory(), sessionFactory, this.getServerSessionListener());

      iss.addSession(serverSession);
      serverSession.getSessions().get(0).setRequestListener(serverSession);
      appSession = serverSession;
    }
    else if (aClass == ClientS6aSession.class) {
      if (sessionId == null) {
        if (args != null && args.length > 0 && args[0] instanceof Request) {
          Request request = (Request) args[0];
          sessionId = request.getSessionId();
        }
        else {
          sessionId = this.sessionFactory.getSessionId();
        }
      }
      IClientS6aSessionData sessionData = (IClientS6aSessionData) this.sessionDataFactory.getAppSessionData(ClientS6aSession.class, sessionId);
      sessionData.setApplicationId(applicationId);
      S6aClientSessionImpl clientSession = new S6aClientSessionImpl(sessionData, getMessageFactory(), sessionFactory, this.getClientSessionListener());

      iss.addSession(clientSession);
      clientSession.getSessions().get(0).setRequestListener(clientSession);
      appSession = clientSession;
    }
    else {
      throw new IllegalArgumentException("Wrong session class: " + aClass + ". Supported[" + ServerS6aSession.class + "]");
    }

    return appSession;
  }
835270
public void sessionCreated(ISession session) {
        if (com.ibm.ejs.ras.TraceComponent.isAnyTracingEnabled() && LoggingUtil.SESSION_LOGGER_CORE.isLoggable(Level.FINE)) {
            LoggingUtil.SESSION_LOGGER_CORE.logp(Level.FINE, methodClassName, "sessionCreated", "sessionObservers.size()=" + _sessionObservers.size());
        }
        if (_sessionObservers == null || _sessionObservers.size() < 1) {
            return;
        }
        ISessionObserver sessionObserver = null;
        for (int i = 0; i < _sessionObservers.size(); i++) {
            sessionObserver = (ISessionObserver) _sessionObservers.get(i);
            sessionObserver.sessionCreated(session);
        }
    }
367338
public void addObjectToSession(String name, Object value) {
        if (session == null) {
            session = new HashMap<>();
        }
        if (logger.isDebugEnabled()) {
            logger.debug("Add object [" + name + "] to session with value [" + value + "]");
        }
        session.put(name, value);
    }
389665
public final void setSession( AbstractSession session ) throws JMSException
    {
        if (session == null)
            this.sessionRef = null;
        else
        {
        	// Consistency check
        	if (sessionRef != null && sessionRef.get() != session)
        		throw new FFMQException("Message session already set","CONSISTENCY");
        		
            this.sessionRef = new WeakReference<>(session);
        }
    }
265108
@SuppressWarnings("unchecked")
	public void sessionCreated(HttpSessionEvent se) {
		Descriptor<? extends Context> descriptor = container.contexts().get(Session.class);
		
		if (descriptor != null) {
			WebContext<HttpSession> context = (WebContext<HttpSession>) container.component(descriptor);
			context.associate(se.getSession());
		}
	}
247072
protected void addSessionInfo(CmsSessionInfo sessionInfo) {

        if (getUserSessionMode() == UserSessionMode.standard) {
            m_sessionStorageProvider.put(sessionInfo);
        } else if (getUserSessionMode() == UserSessionMode.single) {
            CmsUUID userId = sessionInfo.getUserId();
            List<CmsSessionInfo> infos = getSessionInfos(userId);
            if (infos.isEmpty()
                || ((infos.size() == 1) && infos.get(0).getSessionId().equals(sessionInfo.getSessionId()))) {
                m_sessionStorageProvider.put(sessionInfo);
            } else {
                throw new RuntimeException("Can't create another session for the same user.");
            }
        }
    }
474864
protected void initSessionInfo() {

        CmsResource editedResource = null;
        try {
            if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(getParamResource())) {
                editedResource = getCms().readResource(getParamResource());
            }
        } catch (CmsException e) {
            // ignore
        }

        CmsEditorSessionInfo info = null;
        if (editedResource != null) {
            HttpSession session = getSession();
            info = (CmsEditorSessionInfo)session.getAttribute(
                CmsEditorSessionInfo.getEditorSessionInfoKey(editedResource));
            if (info == null) {
                info = new CmsEditorSessionInfo(editedResource.getStructureId());
            }
            if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(m_paramBackLink)) {
                info.setBackLink(m_paramBackLink);
            }
            if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(m_paramElementlanguage)) {
                info.setElementLocale(CmsLocaleManager.getLocale(m_paramElementlanguage));
            }
            if (CmsStringUtil.isNotEmptyOrWhitespaceOnly(m_paramDirectedit)) {
                info.setDirectEdit(Boolean.parseBoolean(m_paramDirectedit));
            }
            session.setAttribute(info.getEditorSessionInfoKey(), info);
        }
        m_editorSessionInfo = info;
    }
1002064
public void attachSession(List<ServiceInstanceToken> instanceTokens){
        ProtocolHeader header = new ProtocolHeader();
        header.setType(ProtocolType.AttachSession);

        String sessionId = connection.getSessionId();
        AttachSessionProtocol protocol = new AttachSessionProtocol(instanceTokens, sessionId);
        connection.submitRequest(header, protocol, null);

    }
91055
public void associate(HttpSession context) {
		try {
			context.setAttribute(COMPONENTS, new ConcurrentHashMap<Descriptor<?>, Object>());
		} catch (Exception e) {
			logger.debug("HTTP session is disabled or invalid in the current environment", e);
		}
	}
659233
public void addSession(String id, Session session) {
    poolGroupManager.addSession(id, session);
    LOG.info("Session " + id +
        " has been added to " + type + " scheduler");
  }