org.apache.catalina.ha.ClusterValve Java Examples

The following examples show how to use org.apache.catalina.ha.ClusterValve. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SimpleTcpCluster.java    From Tomcat8-Source-Read with MIT License 5 votes vote down vote up
/**
 * 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);
            }
        }
    }
}
 
Example #2
Source File: SimpleTcpCluster.java    From Tomcat8-Source-Read with MIT License 5 votes vote down vote up
/**
 * 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);
        }
    }
}
 
Example #3
Source File: SimpleTcpCluster.java    From Tomcat7.0.67 with Apache License 2.0 5 votes vote down vote up
/**
 * 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);
            }
        }
    }
}
 
Example #4
Source File: SimpleTcpCluster.java    From Tomcat7.0.67 with Apache License 2.0 5 votes vote down vote up
/**
 * 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);
        }
    }
}
 
Example #5
Source File: SimpleTcpCluster.java    From tomcatsrc with Apache License 2.0 5 votes vote down vote up
/**
 * 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);
            }
        }
    }
}
 
Example #6
Source File: SimpleTcpCluster.java    From tomcatsrc with Apache License 2.0 5 votes vote down vote up
/**
 * 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);
        }
    }
}
 
Example #7
Source File: SimpleTcpCluster.java    From Tomcat8-Source-Read with MIT License 4 votes vote down vote up
/**
 * Add cluster valve
 * Cluster Valves are only add to container when cluster is started!
 * @param valve The new cluster Valve.
 */
@Override
public void addValve(Valve valve) {
    if (valve instanceof ClusterValve && (!valves.contains(valve)))
        valves.add(valve);
}
 
Example #8
Source File: StandardHostSF.java    From Tomcat8-Source-Read with MIT License 4 votes vote down vote up
/**
 * 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[] = ((Lifecycle) 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(int i = 0 ; i < valves.length ; i++ ) {
                if(!( valves[i] instanceof ClusterValve))
                    hostValves.add(valves[i]);
            }
            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);
    }
}
 
Example #9
Source File: StandardEngineSF.java    From Tomcat8-Source-Read with MIT License 4 votes vote down vote up
/**
 * Store the specified Engine properties.
 *
 * @param aWriter
 *            PrintWriter to which we are storing
 * @param indent
 *            Number of spaces to indent this element
 * @param aEngine
 *            Object whose properties are being stored
 *
 * @exception Exception
 *                if an exception occurs while storing
 */
@Override
public void storeChildren(PrintWriter aWriter, int indent, Object aEngine,
        StoreDescription parentDesc) throws Exception {
    if (aEngine instanceof StandardEngine) {
        StandardEngine engine = (StandardEngine) aEngine;
        // Store nested <Listener> elements
        LifecycleListener listeners[] = ((Lifecycle) engine)
                .findLifecycleListeners();
        storeElementArray(aWriter, indent, listeners);

        // Store nested <Realm> element
        Realm realm = engine.getRealm();
        Realm parentRealm = null;
        // TODO is this case possible? (see it a old Server 5.0 impl)
        if (engine.getParent() != null) {
            parentRealm = engine.getParent().getRealm();
        }
        if (realm != parentRealm) {
            storeElement(aWriter, indent, realm);

        }

        // Store nested <Valve> elements
        Valve valves[] = engine.getPipeline().getValves();
        if(valves != null && valves.length > 0 ) {
            List<Valve> engineValves = new ArrayList<>() ;
            for(int i = 0 ; i < valves.length ; i++ ) {
                if(!( valves[i] instanceof ClusterValve))
                    engineValves.add(valves[i]);
            }
            storeElementArray(aWriter, indent, engineValves.toArray());
        }

        // store all <Cluster> elements
        Cluster cluster = engine.getCluster();
        if (cluster != null) {
            storeElement(aWriter, indent, cluster);
        }
        // store all <Host> elements
        Container children[] = engine.findChildren();
        storeElementArray(aWriter, indent, children);

   }
}
 
Example #10
Source File: SimpleTcpCluster.java    From Tomcat7.0.67 with Apache License 2.0 4 votes vote down vote up
/**
 * Add cluster valve 
 * Cluster Valves are only add to container when cluster is started!
 * @param valve The new cluster Valve.
 */
@Override
public void addValve(Valve valve) {
    if (valve instanceof ClusterValve && (!valves.contains(valve)))
        valves.add(valve);
}
 
Example #11
Source File: SimpleTcpCluster.java    From tomcatsrc with Apache License 2.0 4 votes vote down vote up
/**
 * Add cluster valve 
 * Cluster Valves are only add to container when cluster is started!
 * @param valve The new cluster Valve.
 */
@Override
public void addValve(Valve valve) {
    if (valve instanceof ClusterValve && (!valves.contains(valve)))
        valves.add(valve);
}