Ok great :) On Tue, Jul 29, 2008 at 11:27 PM, Jason Warner <[EMAIL PROTECTED]> wrote:
> I believe it is. My little test setup worked. I'll be documenting it > soon. Thanks for all the work you did on this, Shiva. It made everything a > lot easier. > > > On Tue, Jul 29, 2008 at 1:48 PM, Shiva Kumar H R <[EMAIL PROTECTED]>wrote: > >> Amazing! Is it working now? >> >> >> On Tue, Jul 29, 2008 at 10:50 PM, <[EMAIL PROTECTED]> wrote: >> >>> Author: jawarner >>> Date: Tue Jul 29 10:20:35 2008 >>> New Revision: 680780 >>> >>> URL: http://svn.apache.org/viewvc?rev=680780&view=rev >>> Log: >>> GERONIMO-3759: Geronimo Tomcat Clustering: No GBeans for adding Static >>> Members >>> >>> Added: >>> >>> >>> geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/cluster/StaticMemberGBean.java >>> (with props) >>> >>> >>> geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/interceptor/DisableMcastInterceptor.java >>> (with props) >>> Modified: >>> >>> >>> geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/cluster/ChannelInterceptorGBean.java >>> >>> Modified: >>> geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/cluster/ChannelInterceptorGBean.java >>> URL: >>> http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/cluster/ChannelInterceptorGBean.java?rev=680780&r1=680779&r2=680780&view=diff >>> >>> ============================================================================== >>> --- >>> geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/cluster/ChannelInterceptorGBean.java >>> (original) >>> +++ >>> geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/cluster/ChannelInterceptorGBean.java >>> Tue Jul 29 10:20:35 2008 >>> @@ -24,6 +24,8 @@ >>> import org.slf4j.Logger; >>> import org.slf4j.LoggerFactory; >>> import org.apache.catalina.tribes.ChannelInterceptor; >>> +import >>> org.apache.catalina.tribes.group.interceptors.StaticMembershipInterceptor; >>> +import org.apache.catalina.tribes.membership.StaticMember; >>> >>> public class ChannelInterceptorGBean extends BaseGBean { >>> >>> @@ -39,7 +41,8 @@ >>> nextInterceptor = null; >>> } >>> >>> - public ChannelInterceptorGBean(String className, Map initParams, >>> ChannelInterceptorGBean nextInterceptor) throws Exception { >>> + public ChannelInterceptorGBean(String className, Map initParams, >>> + StaticMemberGBean staticMember, ChannelInterceptorGBean >>> nextInterceptor) throws Exception { >>> >>> super(); // TODO: make it an attribute >>> >>> @@ -64,6 +67,21 @@ >>> // Set the parameters >>> setParameters(interceptor, initParams); >>> >>> + //Add the static member >>> + boolean addNextStaticMember = true; >>> + >>> + while (addNextStaticMember) { >>> + if (staticMember != null && interceptor instanceof >>> StaticMembershipInterceptor){ >>> + StaticMembershipInterceptor staticMembershipInterceptor= >>> (StaticMembershipInterceptor) interceptor; >>> + >>> >>> staticMembershipInterceptor.addStaticMember((StaticMember)staticMember.getInternalObject()); >>> + if ( addNextStaticMember = >>> (staticMember.getNextStaticMember() != null) ? true : false ) { >>> + staticMember = (StaticMemberGBean) >>> staticMember.getNextStaticMember(); >>> + } >>> + } else { >>> + addNextStaticMember = false; >>> + } >>> + } >>> + >>> } >>> >>> public Object getInternalObject() { >>> @@ -92,12 +110,14 @@ >>> GBeanInfoBuilder infoFactory = >>> GBeanInfoBuilder.createStatic("ChannelInterceptor", >>> ChannelInterceptorGBean.class, J2EE_TYPE); >>> infoFactory.addAttribute("className", String.class, true); >>> infoFactory.addAttribute("initParams", Map.class, true); >>> + infoFactory.addReference("StaticMember", >>> StaticMemberGBean.class, StaticMemberGBean.J2EE_TYPE); >>> infoFactory.addReference("NextInterceptor", >>> ChannelInterceptorGBean.class, J2EE_TYPE); >>> infoFactory.addOperation("getInternalObject", "Object"); >>> >>> infoFactory.addOperation("getNextInterceptor","ChannelInterceptorGBean"); >>> infoFactory.setConstructor(new String[] { >>> "className", >>> "initParams", >>> + "StaticMember", >>> "NextInterceptor" }); >>> >>> GBEAN_INFO = infoFactory.getBeanInfo(); >>> @@ -106,4 +126,4 @@ >>> public static GBeanInfo getGBeanInfo() { >>> return GBEAN_INFO; >>> } >>> -} >>> \ No newline at end of file >>> +} >>> >>> Added: >>> geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/cluster/StaticMemberGBean.java >>> URL: >>> http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/cluster/StaticMemberGBean.java?rev=680780&view=auto >>> >>> ============================================================================== >>> --- >>> geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/cluster/StaticMemberGBean.java >>> (added) >>> +++ >>> geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/cluster/StaticMemberGBean.java >>> Tue Jul 29 10:20:35 2008 >>> @@ -0,0 +1,111 @@ >>> +/** >>> + * Licensed to the Apache Software Foundation (ASF) under one or more >>> + * contributor license agreements. See the NOTICE file distributed >>> with >>> + * this work for additional information regarding copyright ownership. >>> + * The ASF licenses this file to You under the Apache License, Version >>> 2.0 >>> + * (the "License"); you may not use this file except in compliance with >>> + * the License. You may obtain a copy of the License at >>> + * >>> + * http://www.apache.org/licenses/LICENSE-2.0 >>> + * >>> + * Unless required by applicable law or agreed to in writing, software >>> + * distributed under the License is distributed on an "AS IS" BASIS, >>> + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or >>> implied. >>> + * See the License for the specific language governing permissions and >>> + * limitations under the License. >>> + */ >>> +package org.apache.geronimo.tomcat.cluster; >>> + >>> +import java.util.Map; >>> + >>> +import org.apache.catalina.tribes.ChannelInterceptor; >>> +import org.apache.catalina.tribes.membership.StaticMember; >>> +import org.apache.commons.logging.Log; >>> +import org.apache.commons.logging.LogFactory; >>> +import org.apache.geronimo.gbean.GBeanInfo; >>> +import org.apache.geronimo.gbean.GBeanInfoBuilder; >>> +import org.apache.geronimo.gbean.GBeanLifecycle; >>> +import org.apache.geronimo.tomcat.BaseGBean; >>> +import org.apache.geronimo.tomcat.ObjectRetriever; >>> + >>> +/** >>> + * @version $Rev$ $Date$ >>> + */ >>> +public class StaticMemberGBean extends BaseGBean implements >>> + GBeanLifecycle, ObjectRetriever { >>> + >>> + private static final Log log = >>> LogFactory.getLog(StaticMemberGBean.class); >>> + >>> + public static final String J2EE_TYPE = "StaticMember"; >>> + >>> + private final StaticMember staticMember; >>> + private final StaticMemberGBean nextStaticMember; >>> + >>> + public StaticMemberGBean() { >>> + staticMember=null; >>> + nextStaticMember=null; >>> + } >>> + >>> + public StaticMemberGBean(String className, Map initParams, >>> StaticMemberGBean nextStaticMember) throws Exception { >>> + >>> + super(); // TODO: make it an attribute >>> + >>> + // Validate >>> + if (className == null) { >>> + throw new IllegalArgumentException("Must have a 'className' >>> attribute."); >>> + } >>> + >>> + if (nextStaticMember != null) { >>> + if (!(nextStaticMember.getInternalObject() instanceof >>> StaticMember)){ >>> + throw new IllegalArgumentException("nextStaticMember is >>> not of type StaticMember."); >>> + } >>> + this.nextStaticMember = nextStaticMember; >>> + } else { >>> + this.nextStaticMember = null; >>> + } >>> + >>> + // Create the StaticMember object >>> + staticMember = (StaticMember) >>> Class.forName(className).newInstance(); >>> + >>> + // Set the parameters >>> + setParameters(staticMember, initParams); >>> + >>> + } >>> + >>> + public Object getInternalObject() { >>> + return staticMember; >>> + } >>> + >>> + public Object getNextStaticMember() { >>> + return nextStaticMember; >>> + } >>> + >>> + public void doFail() { >>> + log.warn("Failed"); >>> + } >>> + >>> + public void doStart() throws Exception { >>> + log.debug("Started StaticMember gbean."); >>> + } >>> + >>> + public void doStop() throws Exception { >>> + log.debug("Stopped StaticMember gbean."); >>> + } >>> + >>> + public static final GBeanInfo GBEAN_INFO; >>> + >>> + static { >>> + GBeanInfoBuilder infoFactory = >>> GBeanInfoBuilder.createStatic("StaticMember", StaticMemberGBean.class, >>> J2EE_TYPE); >>> + infoFactory.addAttribute("className", String.class, true); >>> + infoFactory.addAttribute("initParams", Map.class, true); >>> + infoFactory.addReference("NextStaticMember", >>> StaticMemberGBean.class, J2EE_TYPE); >>> + infoFactory.addOperation("getInternalObject", "Object"); >>> + infoFactory.addOperation("getNextStaticMember", "Object"); >>> + infoFactory.setConstructor(new String[] { "className", >>> "initParams", "NextStaticMember"}); >>> + GBEAN_INFO = infoFactory.getBeanInfo(); >>> + } >>> + >>> + public static GBeanInfo getGBeanInfo() { >>> + return GBEAN_INFO; >>> + } >>> +} >>> >>> Propchange: >>> geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/cluster/StaticMemberGBean.java >>> >>> ------------------------------------------------------------------------------ >>> svn:eol-style = native >>> >>> Propchange: >>> geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/cluster/StaticMemberGBean.java >>> >>> ------------------------------------------------------------------------------ >>> svn:keywords = Date Revision >>> >>> Propchange: >>> geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/cluster/StaticMemberGBean.java >>> >>> ------------------------------------------------------------------------------ >>> svn:mime-type = text/plain >>> >>> Added: >>> geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/interceptor/DisableMcastInterceptor.java >>> URL: >>> http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/interceptor/DisableMcastInterceptor.java?rev=680780&view=auto >>> >>> ============================================================================== >>> --- >>> geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/interceptor/DisableMcastInterceptor.java >>> (added) >>> +++ >>> geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/interceptor/DisableMcastInterceptor.java >>> Tue Jul 29 10:20:35 2008 >>> @@ -0,0 +1,43 @@ >>> +/** >>> + * Licensed to the Apache Software Foundation (ASF) under one or more >>> + * contributor license agreements. See the NOTICE file distributed >>> with >>> + * this work for additional information regarding copyright ownership. >>> + * The ASF licenses this file to You under the Apache License, Version >>> 2.0 >>> + * (the "License"); you may not use this file except in compliance with >>> + * the License. You may obtain a copy of the License at >>> + * >>> + * http://www.apache.org/licenses/LICENSE-2.0 >>> + * >>> + * Unless required by applicable law or agreed to in writing, software >>> + * distributed under the License is distributed on an "AS IS" BASIS, >>> + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or >>> implied. >>> + * See the License for the specific language governing permissions and >>> + * limitations under the License. >>> + */ >>> +package org.apache.geronimo.tomcat.interceptor; >>> + >>> +import org.apache.catalina.tribes.group.ChannelInterceptorBase; >>> +import org.apache.catalina.tribes.ChannelException; >>> +import org.apache.catalina.tribes.Channel; >>> + >>> +/* >>> +This class disables multicast in a tomcat cluster configuration. >>> +It's used in conjunction with a unicast configuration involving >>> +static members. Once the ability to disable multicast is exposed >>> +in tomcat, this class be dropped. >>> +*/ >>> + >>> +/** >>> + * @version $Rev$ $Date$ >>> + */ >>> +public class DisableMcastInterceptor extends ChannelInterceptorBase { >>> + >>> + public DisableMcastInterceptor() { >>> + super(); >>> + } >>> + >>> +public void start(int svc) throws ChannelException { >>> + svc = (svc & (~Channel.MBR_TX_SEQ)); >>> + super.start(svc); >>> + } >>> +} >>> \ No newline at end of file >>> >>> Propchange: >>> geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/interceptor/DisableMcastInterceptor.java >>> >>> ------------------------------------------------------------------------------ >>> svn:eol-style = native >>> >>> Propchange: >>> geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/interceptor/DisableMcastInterceptor.java >>> >>> ------------------------------------------------------------------------------ >>> svn:keywords = Date Revision >>> >>> Propchange: >>> geronimo/server/trunk/plugins/tomcat/geronimo-tomcat6/src/main/java/org/apache/geronimo/tomcat/interceptor/DisableMcastInterceptor.java >>> >>> ------------------------------------------------------------------------------ >>> svn:mime-type = text/plain >>> >>> >>> >> >> >> -- >> Thanks, >> Shiva >> > > > > -- > ~Jason Warner > -- Thanks, Shiva
