stratos-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lahi...@apache.org
Subject stratos git commit: Picking network partition id as a member filter for load balancing
Date Wed, 03 Jun 2015 11:33:52 GMT
Repository: stratos
Updated Branches:
  refs/heads/master 2fe84b918 -> db38d6ff1


Picking network partition id as a member filter for load balancing


Project: http://git-wip-us.apache.org/repos/asf/stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/stratos/commit/db38d6ff
Tree: http://git-wip-us.apache.org/repos/asf/stratos/tree/db38d6ff
Diff: http://git-wip-us.apache.org/repos/asf/stratos/diff/db38d6ff

Branch: refs/heads/master
Commit: db38d6ff1b55fd156ad9a05f65b0a9595f161e86
Parents: 2fe84b9
Author: Lahiru Sandaruwan <lahirus@apache.org>
Authored: Wed Jun 3 16:51:52 2015 +0530
Committer: Lahiru Sandaruwan <lahirus@apache.org>
Committed: Wed Jun 3 16:51:52 2015 +0530

----------------------------------------------------------------------
 .../stratos/common/constants/StratosConstants.java     |  1 +
 .../LoadBalancerCommonTopologyEventReceiver.java       | 13 +++++++++++--
 .../conf/configurator/TopologyFilterConfigurator.java  |  6 ++++++
 .../distribution/src/main/conf/loadbalancer.conf       |  1 -
 4 files changed, 18 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/stratos/blob/db38d6ff/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/constants/StratosConstants.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/constants/StratosConstants.java
b/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/constants/StratosConstants.java
index 942d7d1..194bd81 100644
--- a/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/constants/StratosConstants.java
+++ b/components/org.apache.stratos.common/src/main/java/org/apache/stratos/common/constants/StratosConstants.java
@@ -171,6 +171,7 @@ public class StratosConstants {
     public static final String TOPOLOGY_SERVICE_FILTER = "stratos.topology.service.filter";
     public static final String TOPOLOGY_CLUSTER_FILTER = "stratos.topology.cluster.filter";
     public static final String TOPOLOGY_MEMBER_FILTER = "stratos.topology.member.filter";
+    public static final String TOPOLOGY_NETWORK_PARTITION_FILTER = "stratos.topology.network.partition.filter";
 
     // to identify a lb cluster
     public static final String LOAD_BALANCER_REF = "load.balancer.ref";

http://git-wip-us.apache.org/repos/asf/stratos/blob/db38d6ff/components/org.apache.stratos.load.balancer.common/src/main/java/org/apache/stratos/load/balancer/common/event/receivers/LoadBalancerCommonTopologyEventReceiver.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.load.balancer.common/src/main/java/org/apache/stratos/load/balancer/common/event/receivers/LoadBalancerCommonTopologyEventReceiver.java
b/components/org.apache.stratos.load.balancer.common/src/main/java/org/apache/stratos/load/balancer/common/event/receivers/LoadBalancerCommonTopologyEventReceiver.java
index 622ca80..3b53da3 100644
--- a/components/org.apache.stratos.load.balancer.common/src/main/java/org/apache/stratos/load/balancer/common/event/receivers/LoadBalancerCommonTopologyEventReceiver.java
+++ b/components/org.apache.stratos.load.balancer.common/src/main/java/org/apache/stratos/load/balancer/common/event/receivers/LoadBalancerCommonTopologyEventReceiver.java
@@ -22,6 +22,7 @@ package org.apache.stratos.load.balancer.common.event.receivers;
 import org.apache.commons.lang3.StringUtils;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+import org.apache.stratos.common.constants.StratosConstants;
 import org.apache.stratos.common.domain.LoadBalancingIPType;
 import org.apache.stratos.load.balancer.common.topology.TopologyProvider;
 import org.apache.stratos.messaging.domain.topology.*;
@@ -71,7 +72,11 @@ public class LoadBalancerCommonTopologyEventReceiver extends TopologyEventReceiv
                             String clusterId = member.getClusterId();
                             String memberId = member.getMemberId();
 
-                            String networkPartitionIdFilter = System.getProperty("network.partition.id").trim();
+                            String networkPartitionIdFilter = System.getProperty(
+                                    StratosConstants.TOPOLOGY_NETWORK_PARTITION_FILTER);
+                            if (networkPartitionIdFilter != null) {
+                                networkPartitionIdFilter = networkPartitionIdFilter.trim();
+                            }
                             if (!networkPartitionIdFilter.equals("")) {
                                 if (member.getNetworkPartitionId().equals(networkPartitionIdFilter))
{
                                     addMember(serviceName, clusterId, memberId);
@@ -122,7 +127,11 @@ public class LoadBalancerCommonTopologyEventReceiver extends TopologyEventReceiv
 
                 try {
                     TopologyManager.acquireReadLockForCluster(serviceName, clusterId);
-                    String networkPartitionIdFilter = System.getProperty("network.partition.id").trim();
+                    String networkPartitionIdFilter = System.getProperty(
+                            StratosConstants.TOPOLOGY_NETWORK_PARTITION_FILTER);
+                    if (networkPartitionIdFilter != null) {
+                        networkPartitionIdFilter = networkPartitionIdFilter.trim();
+                    }
                     if (!networkPartitionIdFilter.equals("")) {
                         if (memberActivatedEvent.getNetworkPartitionId().equals(networkPartitionIdFilter))
{
                             addMember(serviceName, clusterId, memberId);

http://git-wip-us.apache.org/repos/asf/stratos/blob/db38d6ff/components/org.apache.stratos.load.balancer/src/main/java/org/apache/stratos/load/balancer/conf/configurator/TopologyFilterConfigurator.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.load.balancer/src/main/java/org/apache/stratos/load/balancer/conf/configurator/TopologyFilterConfigurator.java
b/components/org.apache.stratos.load.balancer/src/main/java/org/apache/stratos/load/balancer/conf/configurator/TopologyFilterConfigurator.java
index 44ddc2d..381988c 100644
--- a/components/org.apache.stratos.load.balancer/src/main/java/org/apache/stratos/load/balancer/conf/configurator/TopologyFilterConfigurator.java
+++ b/components/org.apache.stratos.load.balancer/src/main/java/org/apache/stratos/load/balancer/conf/configurator/TopologyFilterConfigurator.java
@@ -47,10 +47,16 @@ public class TopologyFilterConfigurator {
             System.setProperty(StratosConstants.TOPOLOGY_MEMBER_FILTER, memberFilter);
         }
 
+        String networkPartitionFilter = configuration.getTopologyMemberFilter();
+        if (StringUtils.isNotBlank(networkPartitionFilter)) {
+            System.setProperty(StratosConstants.TOPOLOGY_NETWORK_PARTITION_FILTER, memberFilter);
+        }
+
         if (log.isDebugEnabled()) {
             log.debug(String.format("Setting service-fTopologyFilterConfigurator.javailter
= %s", System.getProperty(StratosConstants.TOPOLOGY_SERVICE_FILTER)));
             log.debug(String.format("Setting cluster-filter = %s", System.getProperty(StratosConstants.TOPOLOGY_CLUSTER_FILTER)));
             log.debug(String.format("Setting member-filter = %s", System.getProperty(StratosConstants.TOPOLOGY_MEMBER_FILTER)));
+            log.debug(String.format("Setting network-partition-filter = %s", System.getProperty(StratosConstants.TOPOLOGY_NETWORK_PARTITION_FILTER)));
         }
     }
 }

http://git-wip-us.apache.org/repos/asf/stratos/blob/db38d6ff/products/load-balancer/modules/distribution/src/main/conf/loadbalancer.conf
----------------------------------------------------------------------
diff --git a/products/load-balancer/modules/distribution/src/main/conf/loadbalancer.conf b/products/load-balancer/modules/distribution/src/main/conf/loadbalancer.conf
index 6e38eba..3d005ca 100644
--- a/products/load-balancer/modules/distribution/src/main/conf/loadbalancer.conf
+++ b/products/load-balancer/modules/distribution/src/main/conf/loadbalancer.conf
@@ -76,7 +76,6 @@ loadbalancer {
     cep-port: 7615;
 
     # Network partition id
-    # Provide the network partition id if cep-stats-publisher is set to true.
     # Disabled in default
     # network-partition-id: network-partition-1;
 


Mime
View raw message