Author: kfujino Date: Fri Apr 4 04:25:07 2014 New Revision: 1584513 URL: http://svn.apache.org/r1584513 Log: Backport r1584505 and r1584507. -Simplify the code of o.a.c.ha.tcp.SimpleTcpCluster. In order to add or remove cluster valve to Container, use pipeline instead of IntrospectionUtils. -There is no need to set cluster instance when SimpleTcpCluster.unregisterClusterValve is called. Set null than cluster instance for cleanup.
Modified: tomcat/tc7.0.x/trunk/java/org/apache/catalina/ha/tcp/SimpleTcpCluster.java tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml Modified: tomcat/tc7.0.x/trunk/java/org/apache/catalina/ha/tcp/SimpleTcpCluster.java URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/catalina/ha/tcp/SimpleTcpCluster.java?rev=1584513&r1=1584512&r2=1584513&view=diff ============================================================================== --- tomcat/tc7.0.x/trunk/java/org/apache/catalina/ha/tcp/SimpleTcpCluster.java (original) +++ tomcat/tc7.0.x/trunk/java/org/apache/catalina/ha/tcp/SimpleTcpCluster.java Fri Apr 4 04:25:07 2014 @@ -717,10 +717,8 @@ public class SimpleTcpCluster extends Li /** * register all cluster valve to host or engine - * @throws Exception - * @throws ClassNotFoundException */ - protected void registerClusterValve() throws Exception { + protected void registerClusterValve() { if(container != null ) { for (Iterator<Valve> iter = valves.iterator(); iter.hasNext();) { ClusterValve valve = (ClusterValve) iter.next(); @@ -728,10 +726,7 @@ public class SimpleTcpCluster extends Li log.debug("Invoking addValve on " + getContainer() + " with class=" + valve.getClass().getName()); if (valve != null) { - IntrospectionUtils.callMethodN(getContainer(), "addValve", - new Object[] { valve }, - new Class[] { org.apache.catalina.Valve.class }); - + container.getPipeline().addValve(valve); valve.setCluster(this); } } @@ -740,20 +735,16 @@ public class SimpleTcpCluster extends Li /** * unregister all cluster valve to host or engine - * @throws Exception - * @throws ClassNotFoundException */ - protected void unregisterClusterValve() throws Exception { + 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) { - IntrospectionUtils.callMethodN(getContainer(), "removeValve", - new Object[] { valve }, - new Class[] { org.apache.catalina.Valve.class }); - valve.setCluster(this); + container.getPipeline().removeValve(valve); + valve.setCluster(null); } } } Modified: tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml?rev=1584513&r1=1584512&r2=1584513&view=diff ============================================================================== --- tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml (original) +++ tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml Fri Apr 4 04:25:07 2014 @@ -97,6 +97,16 @@ <code>org.apache.catalina.ha.session.BackupManager</code> and <code>org.apache.catalina.ha.session.DeltaManager</code>. (kfujino) </scode> + <scode> + Simplify the code of <code>o.a.c.ha.tcp.SimpleTcpCluster</code>. In + order to add or remove cluster valve to Container, use pipeline instead + of <code>IntrospectionUtils</code>. (kfujino) + </scode> + <fix> + There is no need to set cluster instance when + <code>SimpleTcpCluster.unregisterClusterValve</code> is called. + Set null than cluster instance for cleanup. (kfujino) + </fix> </changelog> </subsection> <subsection name="Web applications"> --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org