Skip to content

Commit

Permalink
Arrange timeout and check Load: > 0 for usuable nodes.
Browse files Browse the repository at this point in the history
  • Loading branch information
jfclere committed Feb 23, 2010
1 parent 82dca56 commit d8def5c
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion test/java/org/jboss/mod_cluster/Maintest.java
Expand Up @@ -187,6 +187,7 @@ static LifecycleListener createClusterListener(String groupa, int groupp, boolea
jcluster.setStickySession(stickySession);
jcluster.setStickySessionRemove(stickySessionRemove);
jcluster.setStickySessionForce(stickySessionForce);
jcluster.setNodeTimeout(20000);
if (advertiseSecurityKey != null)
jcluster.setAdvertiseSecurityKey(advertiseSecurityKey);
lifecycle = jcluster;
Expand All @@ -199,6 +200,7 @@ static LifecycleListener createClusterListener(String groupa, int groupp, boolea
pcluster.setStickySession(stickySession);
pcluster.setStickySessionRemove(stickySessionRemove);
pcluster.setStickySessionForce(stickySessionForce);
pcluster.setNodeTimeout(20000);
if (advertiseSecurityKey != null)
pcluster.setAdvertiseSecurityKey(advertiseSecurityKey);
lifecycle = pcluster;
Expand Down Expand Up @@ -344,14 +346,28 @@ static boolean checkProxyInfo(String result, String [] nodes) {
String [] results = records[i].split(",");
/* result[0] should be Node: [n] */
String [] data = results[0].split(": ");

if ("Node".equals(data[0])) {
if (n == null)
return false; /* we shouldn't have a node */

/* Look for the "Load: " */
boolean nodeok = false;
for (int j=0; j<results.length; j++) {
int id = results[j].indexOf("Load: ");
if (id >= 0) {
String res = results[j].substring(6);
if (Integer.parseInt(res) > 0) {
nodeok = true;
break;
}
}
}
/* result[1] should be Name: node_name */
data = results[1].split(": ");
for (int j=0; j<nodes.length; j++) {
if (nodes[j].equals(data[1])) {
n[j] = true; /* found it */
n[j] = nodeok; /* found it */
}
}
}
Expand Down Expand Up @@ -384,6 +400,7 @@ public static boolean testPort(int port) {
}
return ret;
}
/* Wait until the node is in the ok status (load>0). */
static boolean TestForNodes(LifecycleListener lifecycle, String [] nodes) {
int countinfo = 0;
while ((!Maintest.checkProxyInfo(lifecycle, nodes)) && countinfo < 20) {
Expand Down

0 comments on commit d8def5c

Please sign in to comment.