Search in sources :

Example 1 with ClusterValve

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

the class SimpleTcpCluster method registerClusterValve.

/**
 * register all cluster valve to host or engine
 */
protected void registerClusterValve() {
    if (container != null) {
        for (Iterator<Valve> iter = valves.iterator(); iter.hasNext(); ) {
            ClusterValve valve = (ClusterValve) iter.next();
            if (log.isDebugEnabled())
                log.debug("Invoking addValve on " + getContainer() + " with class=" + valve.getClass().getName());
            if (valve != null) {
                container.getPipeline().addValve(valve);
                valve.setCluster(this);
            }
        }
    }
}
Also used : Valve(org.apache.catalina.Valve) JvmRouteBinderValve(org.apache.catalina.ha.session.JvmRouteBinderValve) ClusterValve(org.apache.catalina.ha.ClusterValve) ClusterValve(org.apache.catalina.ha.ClusterValve)

Example 2 with ClusterValve

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

the class StandardHostSF method storeChildren.

/**
 * Store the specified Host properties and children
 * (Listener,Alias,Realm,Valve,Cluster, Context)
 *
 * @param aWriter
 *            PrintWriter to which we are storing
 * @param indent
 *            Number of spaces to indent this element
 * @param aHost
 *            Host whose properties are being stored
 *
 * @exception Exception
 *                if an exception occurs while storing
 */
@Override
public void storeChildren(PrintWriter aWriter, int indent, Object aHost, StoreDescription parentDesc) throws Exception {
    if (aHost instanceof StandardHost) {
        StandardHost host = (StandardHost) aHost;
        // Store nested <Listener> elements
        LifecycleListener[] listeners = host.findLifecycleListeners();
        storeElementArray(aWriter, indent, listeners);
        // Store nested <Alias> elements
        String[] aliases = host.findAliases();
        getStoreAppender().printTagArray(aWriter, "Alias", indent + 2, aliases);
        // Store nested <Realm> element
        Realm realm = host.getRealm();
        if (realm != null) {
            Realm parentRealm = null;
            if (host.getParent() != null) {
                parentRealm = host.getParent().getRealm();
            }
            if (realm != parentRealm) {
                storeElement(aWriter, indent, realm);
            }
        }
        // Store nested <Valve> elements
        Valve[] valves = host.getPipeline().getValves();
        if (valves != null && valves.length > 0) {
            List<Valve> hostValves = new ArrayList<>();
            for (Valve valve : valves) {
                if (!(valve instanceof ClusterValve)) {
                    hostValves.add(valve);
                }
            }
            storeElementArray(aWriter, indent, hostValves.toArray());
        }
        // store all <Cluster> elements
        Cluster cluster = host.getCluster();
        if (cluster != null) {
            Cluster parentCluster = null;
            if (host.getParent() != null) {
                parentCluster = host.getParent().getCluster();
            }
            if (cluster != parentCluster) {
                storeElement(aWriter, indent, cluster);
            }
        }
        // store all <Context> elements
        Container[] children = host.findChildren();
        storeElementArray(aWriter, indent, children);
    }
}
Also used : ArrayList(java.util.ArrayList) Cluster(org.apache.catalina.Cluster) LifecycleListener(org.apache.catalina.LifecycleListener) ClusterValve(org.apache.catalina.ha.ClusterValve) Container(org.apache.catalina.Container) StandardHost(org.apache.catalina.core.StandardHost) ClusterValve(org.apache.catalina.ha.ClusterValve) Valve(org.apache.catalina.Valve) Realm(org.apache.catalina.Realm)

Example 3 with ClusterValve

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

the class SimpleTcpCluster method registerClusterValve.

/**
 * register all cluster valve to host or engine
 */
protected void registerClusterValve() {
    if (container != null) {
        for (Valve v : valves) {
            ClusterValve valve = (ClusterValve) v;
            if (log.isDebugEnabled()) {
                log.debug("Invoking addValve on " + getContainer() + " with class=" + valve.getClass().getName());
            }
            if (valve != null) {
                container.getPipeline().addValve(valve);
                valve.setCluster(this);
            }
        }
    }
}
Also used : Valve(org.apache.catalina.Valve) JvmRouteBinderValve(org.apache.catalina.ha.session.JvmRouteBinderValve) ClusterValve(org.apache.catalina.ha.ClusterValve) ClusterValve(org.apache.catalina.ha.ClusterValve)

Example 4 with ClusterValve

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

the class SimpleTcpCluster method unregisterClusterValve.

/**
 * unregister all cluster valve to host or engine
 */
protected void unregisterClusterValve() {
    for (Valve v : valves) {
        ClusterValve valve = (ClusterValve) v;
        if (log.isDebugEnabled()) {
            log.debug("Invoking removeValve on " + getContainer() + " with class=" + valve.getClass().getName());
        }
        if (valve != null) {
            container.getPipeline().removeValve(valve);
            valve.setCluster(null);
        }
    }
}
Also used : Valve(org.apache.catalina.Valve) JvmRouteBinderValve(org.apache.catalina.ha.session.JvmRouteBinderValve) ClusterValve(org.apache.catalina.ha.ClusterValve) ClusterValve(org.apache.catalina.ha.ClusterValve)

Example 5 with ClusterValve

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

the class SimpleTcpCluster method unregisterClusterValve.

/**
 * unregister all cluster valve to host or engine
 */
protected void unregisterClusterValve() {
    for (Iterator<Valve> iter = valves.iterator(); iter.hasNext(); ) {
        ClusterValve valve = (ClusterValve) iter.next();
        if (log.isDebugEnabled())
            log.debug("Invoking removeValve on " + getContainer() + " with class=" + valve.getClass().getName());
        if (valve != null) {
            container.getPipeline().removeValve(valve);
            valve.setCluster(null);
        }
    }
}
Also used : Valve(org.apache.catalina.Valve) JvmRouteBinderValve(org.apache.catalina.ha.session.JvmRouteBinderValve) ClusterValve(org.apache.catalina.ha.ClusterValve) ClusterValve(org.apache.catalina.ha.ClusterValve)

Aggregations

Valve (org.apache.catalina.Valve)6 ClusterValve (org.apache.catalina.ha.ClusterValve)6 JvmRouteBinderValve (org.apache.catalina.ha.session.JvmRouteBinderValve)4 ArrayList (java.util.ArrayList)2 Cluster (org.apache.catalina.Cluster)2 Container (org.apache.catalina.Container)2 LifecycleListener (org.apache.catalina.LifecycleListener)2 Realm (org.apache.catalina.Realm)2 StandardEngine (org.apache.catalina.core.StandardEngine)1 StandardHost (org.apache.catalina.core.StandardHost)1