Skip to content
Permalink
Browse files
GEODE-6243: New method to get number of members. (#33)
        * New method added to get the number of members for each role.
	* Calculating unique addresses for number of members caused an issue when all VMs are in the same physical machine.
  • Loading branch information
nabarunnag committed Jan 3, 2019
1 parent 104bbf5 commit 4e909433c93b6aa83288e2616192c8db5710a5a0
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 2 deletions.
@@ -60,8 +60,8 @@ public PrePopulateRegion(long keyRangeToPrepopulate) {
public void run(TestContext context) throws InterruptedException {
Cache serverCache = (Cache) context.getAttribute("SERVER_CACHE");
Region<Long, Portfolio> region = serverCache.getRegion("region");
int numLocators = context.getHostsForRole(LOCATOR).size();
int numServers = context.getHostsForRole(SERVER).size();
int numLocators = context.getHostsIDsForRole(LOCATOR).size();
int numServers = context.getHostsIDsForRole(SERVER).size();
int jvmID = context.getJvmID();

run(region, numLocators, numServers, jvmID);
@@ -25,6 +25,8 @@
public interface TestContext extends Serializable {
Set<InetAddress> getHostsForRole(String role);

Set<Integer> getHostsIDsForRole(String role);

File getOutputDir();

/**
@@ -48,6 +48,11 @@ public Set<InetAddress> getHostsForRole(String role) {
return sharedContext.getHostsForRole(role);
}

@Override
public Set<Integer> getHostsIDsForRole(String role) {
return sharedContext.getHostIDsForRole(role);
}

@Override
public void setAttribute(String attribute, Object value) {
attributeMap.put(attribute, value);
@@ -45,4 +45,11 @@ public Set<InetAddress> getHostsForRole(String role) {
.map(mapping -> mapping.getNode().getAddress())
.collect(Collectors.toSet());
}

public Set<Integer> getHostIDsForRole(String role) {
return jvmMappings.stream()
.filter(mapping -> mapping.getRole().equals(role))
.map(mapping -> mapping.getId())
.collect(Collectors.toSet());
}
}

0 comments on commit 4e90943

Please sign in to comment.