Search in sources :

Example 1 with ClusterSession

use of org.apache.catalina.ha.ClusterSession in project tomcat70 by apache.

the class ReplicationValve method createPrimaryIndicator.

/**
 * Mark Request that processed at primary node with attribute
 * primaryIndicatorName
 *
 * @param request
 * @throws IOException
 */
protected void createPrimaryIndicator(Request request) throws IOException {
    String id = request.getRequestedSessionId();
    if ((id != null) && (id.length() > 0)) {
        Manager manager = request.getContext().getManager();
        Session session = manager.findSession(id);
        if (session instanceof ClusterSession) {
            ClusterSession cses = (ClusterSession) session;
            if (log.isDebugEnabled())
                log.debug(sm.getString("ReplicationValve.session.indicator", request.getContext().getName(), id, primaryIndicatorName, Boolean.valueOf(cses.isPrimarySession())));
            request.setAttribute(primaryIndicatorName, cses.isPrimarySession() ? Boolean.TRUE : Boolean.FALSE);
        } else {
            if (log.isDebugEnabled()) {
                if (session != null) {
                    log.debug(sm.getString("ReplicationValve.session.found", request.getContext().getName(), id));
                } else {
                    log.debug(sm.getString("ReplicationValve.session.invalid", request.getContext().getName(), id));
                }
            }
        }
    }
}
Also used : ClusterSession(org.apache.catalina.ha.ClusterSession) DeltaManager(org.apache.catalina.ha.session.DeltaManager) ClusterManager(org.apache.catalina.ha.ClusterManager) StringManager(org.apache.tomcat.util.res.StringManager) Manager(org.apache.catalina.Manager) Session(org.apache.catalina.Session) ClusterSession(org.apache.catalina.ha.ClusterSession) DeltaSession(org.apache.catalina.ha.session.DeltaSession)

Example 2 with ClusterSession

use of org.apache.catalina.ha.ClusterSession in project tomcat by apache.

the class ReplicationValve method createPrimaryIndicator.

/**
 * Mark Request that processed at primary node with attribute
 * primaryIndicatorName
 *
 * @param request The Servlet request
 * @throws IOException IO error finding session
 */
protected void createPrimaryIndicator(Request request) throws IOException {
    String id = request.getRequestedSessionId();
    if ((id != null) && (id.length() > 0)) {
        Manager manager = request.getContext().getManager();
        Session session = manager.findSession(id);
        if (session instanceof ClusterSession) {
            ClusterSession cses = (ClusterSession) session;
            if (log.isDebugEnabled()) {
                log.debug(sm.getString("ReplicationValve.session.indicator", request.getContext().getName(), id, primaryIndicatorName, Boolean.valueOf(cses.isPrimarySession())));
            }
            request.setAttribute(primaryIndicatorName, cses.isPrimarySession() ? Boolean.TRUE : Boolean.FALSE);
        } else {
            if (log.isDebugEnabled()) {
                if (session != null) {
                    log.debug(sm.getString("ReplicationValve.session.found", request.getContext().getName(), id));
                } else {
                    log.debug(sm.getString("ReplicationValve.session.invalid", request.getContext().getName(), id));
                }
            }
        }
    }
}
Also used : ClusterSession(org.apache.catalina.ha.ClusterSession) DeltaManager(org.apache.catalina.ha.session.DeltaManager) ClusterManager(org.apache.catalina.ha.ClusterManager) StringManager(org.apache.tomcat.util.res.StringManager) Manager(org.apache.catalina.Manager) ClusterSession(org.apache.catalina.ha.ClusterSession) Session(org.apache.catalina.Session) DeltaSession(org.apache.catalina.ha.session.DeltaSession)

Aggregations

Manager (org.apache.catalina.Manager)2 Session (org.apache.catalina.Session)2 ClusterManager (org.apache.catalina.ha.ClusterManager)2 ClusterSession (org.apache.catalina.ha.ClusterSession)2 DeltaManager (org.apache.catalina.ha.session.DeltaManager)2 DeltaSession (org.apache.catalina.ha.session.DeltaSession)2 StringManager (org.apache.tomcat.util.res.StringManager)2