You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stratos.apache.org by la...@apache.org on 2015/06/03 10:52:21 UTC
stratos git commit: Fix issue of network partition id based filter
for members
Repository: stratos
Updated Branches:
refs/heads/master c5d89bdd6 -> 91335592e
Fix issue of network partition id based filter for members
Project: http://git-wip-us.apache.org/repos/asf/stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/stratos/commit/91335592
Tree: http://git-wip-us.apache.org/repos/asf/stratos/tree/91335592
Diff: http://git-wip-us.apache.org/repos/asf/stratos/diff/91335592
Branch: refs/heads/master
Commit: 91335592e30cb4659ce471bb544ffb4bb9fa632c
Parents: c5d89bd
Author: Lahiru Sandaruwan <la...@apache.org>
Authored: Wed Jun 3 14:22:02 2015 +0530
Committer: Lahiru Sandaruwan <la...@apache.org>
Committed: Wed Jun 3 14:22:10 2015 +0530
----------------------------------------------------------------------
...LoadBalancerCommonTopologyEventReceiver.java | 26 +++++++++++++++++---
.../src/main/conf/loadbalancer.conf | 3 ++-
2 files changed, 25 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/stratos/blob/91335592/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 faac524..622ca80 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
@@ -66,8 +66,21 @@ public class LoadBalancerCommonTopologyEventReceiver extends TopologyEventReceiv
for (Cluster cluster : service.getClusters()) {
for (Member member : cluster.getMembers()) {
if (member.getStatus() == MemberStatus.Active) {
- addMember(cluster.getServiceName(), member.getClusterId(), member.getMemberId());
- membersFound = true;
+
+ String serviceName = member.getServiceName();
+ String clusterId = member.getClusterId();
+ String memberId = member.getMemberId();
+
+ String networkPartitionIdFilter = System.getProperty("network.partition.id").trim();
+ if (!networkPartitionIdFilter.equals("")) {
+ if (member.getNetworkPartitionId().equals(networkPartitionIdFilter)) {
+ addMember(serviceName, clusterId, memberId);
+ membersFound = true;
+ }
+ } else {
+ addMember(serviceName, clusterId, memberId);
+ membersFound = true;
+ }
}
}
}
@@ -109,7 +122,14 @@ public class LoadBalancerCommonTopologyEventReceiver extends TopologyEventReceiv
try {
TopologyManager.acquireReadLockForCluster(serviceName, clusterId);
- addMember(serviceName, clusterId, memberId);
+ String networkPartitionIdFilter = System.getProperty("network.partition.id").trim();
+ if (!networkPartitionIdFilter.equals("")) {
+ if (memberActivatedEvent.getNetworkPartitionId().equals(networkPartitionIdFilter)) {
+ addMember(serviceName, clusterId, memberId);
+ }
+ } else {
+ addMember(serviceName, clusterId, memberId);
+ }
} catch (Exception e) {
log.error("Error processing event", e);
} finally {
http://git-wip-us.apache.org/repos/asf/stratos/blob/91335592/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 dd283d0..6e38eba 100644
--- a/products/load-balancer/modules/distribution/src/main/conf/loadbalancer.conf
+++ b/products/load-balancer/modules/distribution/src/main/conf/loadbalancer.conf
@@ -77,7 +77,8 @@ loadbalancer {
# Network partition id
# Provide the network partition id if cep-stats-publisher is set to true.
- network-partition-id: network-partition-1;
+ # Disabled in default
+ # network-partition-id: network-partition-1;
# Multi-tenancy
# If this property is set to true, all incoming request URLs will be scanned using the given tenant-identifier-regex