geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jawar...@apache.org
Subject svn commit: r689137 - in /geronimo/server/trunk/plugins/clustering/geronimo-clustering-wadi/src/main/java/org/apache/geronimo/clustering/wadi: TribesDispatcherHolder.java WadiStaticMember.java
Date Tue, 26 Aug 2008 17:12:17 GMT
Author: jawarner
Date: Tue Aug 26 10:12:16 2008
New Revision: 689137

URL: http://svn.apache.org/viewvc?rev=689137&view=rev
Log:
GERONIMO-4264: Enable static configuration of a wadi cluster

Added:
    geronimo/server/trunk/plugins/clustering/geronimo-clustering-wadi/src/main/java/org/apache/geronimo/clustering/wadi/WadiStaticMember.java
  (with props)
Modified:
    geronimo/server/trunk/plugins/clustering/geronimo-clustering-wadi/src/main/java/org/apache/geronimo/clustering/wadi/TribesDispatcherHolder.java

Modified: geronimo/server/trunk/plugins/clustering/geronimo-clustering-wadi/src/main/java/org/apache/geronimo/clustering/wadi/TribesDispatcherHolder.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/clustering/geronimo-clustering-wadi/src/main/java/org/apache/geronimo/clustering/wadi/TribesDispatcherHolder.java?rev=689137&r1=689136&r2=689137&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/clustering/geronimo-clustering-wadi/src/main/java/org/apache/geronimo/clustering/wadi/TribesDispatcherHolder.java
(original)
+++ geronimo/server/trunk/plugins/clustering/geronimo-clustering-wadi/src/main/java/org/apache/geronimo/clustering/wadi/TribesDispatcherHolder.java
Tue Aug 26 10:12:16 2008
@@ -17,10 +17,12 @@
 package org.apache.geronimo.clustering.wadi;
 
 import java.net.URI;
-import java.util.Collections;
+import java.util.HashSet;
+import java.util.Properties;
 
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
+import org.apache.catalina.tribes.membership.StaticMember;
 import org.apache.geronimo.clustering.LocalNode;
 import org.apache.geronimo.clustering.Node;
 import org.apache.geronimo.gbean.GBeanLifecycle;
@@ -50,6 +52,10 @@
     private final String clusterName;
     private final LocalNode node;
     private final ClassLoader cl;
+    private final boolean disableMCastService;
+    private final int receiverPort;
+    private final Properties mcastServiceProperties;
+    private final WadiStaticMember staticMember;
     private final DispatcherRegistry dispatcherRegistry;
 
     private TribesDispatcher dispatcher;
@@ -58,6 +64,10 @@
     public TribesDispatcherHolder(@ParamSpecial(type=SpecialAttributeType.classLoader) ClassLoader
cl,
         @ParamAttribute(name=GBEAN_ATTR_END_POINT_URI) URI endPointURI,
         @ParamAttribute(name=GBEAN_ATTR_CLUSTER_NAME) String clusterName,
+        @ParamAttribute(name=GBEAN_ATTR_DISABLE_MCAST) boolean disableMCastService,
+        @ParamAttribute(name=GBEAN_ATTR_RECEIVER_PORT) int receiverPort,
+        @ParamAttribute(name=GBEAN_ATTR_MCAST_PROPERTIES) Properties mcastServiceProperties,
+        @ParamReference(name=GBEAN_REF_STATIC_MEMBER) WadiStaticMember staticMember,
         @ParamReference(name=GBEAN_REF_NODE) LocalNode node) {
         if (null == endPointURI) {
             throw new IllegalArgumentException("endPointURI is required");
@@ -68,8 +78,17 @@
         } else if (null == cl) {
             throw new IllegalArgumentException("cl is required");
         }
+        
+        if (receiverPort < 1) {
+            receiverPort = 4000;
+        }
+        
         this.endPointURI = endPointURI;
         this.clusterName = clusterName;
+        this.disableMCastService = disableMCastService;
+        this.staticMember = staticMember;
+        this.receiverPort = receiverPort;
+        this.mcastServiceProperties = mcastServiceProperties;
         this.node = node;
         this.cl = cl;
         
@@ -77,10 +96,32 @@
     }
 
     public void doStart() throws Exception {
+        
+        HashSet<StaticMember> staticMemberCollection = new HashSet<StaticMember>();
+        
+        log.debug("Attempting to set static members");
+        if (staticMember != null) {
+           
+            log.debug("Attempting to add static member: {}", ((StaticMember)staticMember.getStaticMember()).getPort());
+            staticMemberCollection.add((StaticMember)staticMember.getStaticMember());
+            WadiStaticMember nextStaticMember = (WadiStaticMember) staticMember.getNextStaticMember();
+            
+            while(nextStaticMember != null) {
+                log.debug("Attempting to add static member: {}", ((StaticMember)staticMember.getStaticMember()).getPort());
+                staticMemberCollection.add((StaticMember)nextStaticMember.getStaticMember());
+                nextStaticMember = (WadiStaticMember) nextStaticMember.getNextStaticMember();
+            }
+        }
+        
+        
+        log.debug("List of static members: {}", staticMemberCollection);
         dispatcher = new TribesDispatcher(clusterName,
             node.getName(),
             new URIEndPoint(endPointURI),
-            Collections.EMPTY_SET);
+            staticMemberCollection,
+            disableMCastService,
+            mcastServiceProperties,
+            receiverPort);
         dispatcher.start();
         
         adminServiceSpace = new AdminServiceSpace(dispatcher,
@@ -134,6 +175,10 @@
     
     public static final String GBEAN_ATTR_END_POINT_URI = "endPointURI";
     public static final String GBEAN_ATTR_CLUSTER_NAME = "clusterName";
+    public static final String GBEAN_ATTR_DISABLE_MCAST = "disableMCastService";
+    public static final String GBEAN_ATTR_RECEIVER_PORT = "receiverPort";
+    public static final String GBEAN_ATTR_MCAST_PROPERTIES = "mcastServiceProperties";
+    public static final String GBEAN_REF_STATIC_MEMBER = "staticMember";
     public static final String GBEAN_ATTR_CLUSTER_URI = "clusterUri";
     public static final String GBEAN_REF_NODE = "Node";
 }

Added: geronimo/server/trunk/plugins/clustering/geronimo-clustering-wadi/src/main/java/org/apache/geronimo/clustering/wadi/WadiStaticMember.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/clustering/geronimo-clustering-wadi/src/main/java/org/apache/geronimo/clustering/wadi/WadiStaticMember.java?rev=689137&view=auto
==============================================================================
--- geronimo/server/trunk/plugins/clustering/geronimo-clustering-wadi/src/main/java/org/apache/geronimo/clustering/wadi/WadiStaticMember.java
(added)
+++ geronimo/server/trunk/plugins/clustering/geronimo-clustering-wadi/src/main/java/org/apache/geronimo/clustering/wadi/WadiStaticMember.java
Tue Aug 26 10:12:16 2008
@@ -0,0 +1,108 @@
+/**
+ *  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.clustering.wadi;
+
+import org.apache.catalina.tribes.membership.StaticMember;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.geronimo.gbean.GBeanLifecycle;
+import org.apache.geronimo.gbean.annotation.ParamAttribute;
+import org.apache.geronimo.gbean.annotation.ParamReference;
+
+/**
+ * 
+ * @version $Rev$ $Date$
+ */
+
+public class WadiStaticMember implements GBeanLifecycle {
+    
+    private static final Log log = LogFactory.getLog(WadiStaticMember.class);
+    
+    private final String classname;
+    private final int port;
+    private final int securePort;
+    private final String host;
+    private final String domain;
+    private final byte[] uniqueId;
+    private final WadiStaticMember  nextWadiStaticMember;
+    
+    private final StaticMember staticMember;
+    
+    public WadiStaticMember(@ParamAttribute(name=GBEAN_ATTR_CLASSNAME) String classname,

+            @ParamAttribute(name=GBEAN_ATTR_PORT) int port,
+            @ParamAttribute(name=GBEAN_ATTR_SECURE_PORT) int securePort,
+            @ParamAttribute(name=GBEAN_ATTR_HOST) String host,
+            @ParamAttribute(name=GBEAN_ATTR_DOMAIN) String domain,
+            @ParamAttribute(name=GBEAN_ATTR_UNIQUE_ID) byte[] uniqueId,
+            @ParamReference(name=GBEAN_REF_NEXT_STATIC_MEMBER) WadiStaticMember nextWadiStaticMember)
throws Exception {
+        
+        if (classname == null) {
+            throw new IllegalArgumentException("classname is required");
+        } else if (host == null) {
+            throw new IllegalArgumentException("host is required");
+        } else if (domain == null) {
+            throw new IllegalArgumentException("domain is required");
+        } else if (uniqueId == null) {
+            throw new IllegalArgumentException("UniqueId is required");
+        }
+        
+        this.classname = classname;
+        this.port = port;
+        this.securePort = securePort;
+        this.host = host;
+        this.domain = domain;
+        this.uniqueId = uniqueId;
+        this.nextWadiStaticMember = nextWadiStaticMember;
+        
+        staticMember = (StaticMember) Class.forName(classname).newInstance();
+        staticMember.setPort(port);
+        staticMember.setSecurePort(securePort);
+        staticMember.setHost(host);
+        staticMember.setDomain(domain);
+        staticMember.setUniqueId(uniqueId);        
+        
+    }
+
+    public void doStart() throws Exception {
+        log.debug("Started WadiStaticMember");
+    }
+    
+    public void doFail() {
+        log.debug("Failed to create WadiStaticMember");
+    }
+
+    public void doStop() throws Exception {
+        log.debug("Stopped WadiStaticMember");
+
+    }
+    public Object getNextStaticMember() {
+        return nextWadiStaticMember;
+    }
+    
+    public Object getStaticMember() {
+        return staticMember;
+    }
+    
+    public static final String GBEAN_ATTR_CLASSNAME = "className";
+    public static final String GBEAN_ATTR_PORT = "port";
+    public static final String GBEAN_ATTR_SECURE_PORT = "securePort";
+    public static final String GBEAN_ATTR_HOST = "host";
+    public static final String GBEAN_ATTR_DOMAIN = "domain";
+    public static final String GBEAN_ATTR_UNIQUE_ID = "UniqueId";
+    public static final String GBEAN_REF_NEXT_STATIC_MEMBER = "nextWadiStaticMember";
+    
+}

Propchange: geronimo/server/trunk/plugins/clustering/geronimo-clustering-wadi/src/main/java/org/apache/geronimo/clustering/wadi/WadiStaticMember.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/server/trunk/plugins/clustering/geronimo-clustering-wadi/src/main/java/org/apache/geronimo/clustering/wadi/WadiStaticMember.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/server/trunk/plugins/clustering/geronimo-clustering-wadi/src/main/java/org/apache/geronimo/clustering/wadi/WadiStaticMember.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain



Mime
View raw message