JBoss Native SVN: r1924 - trunk/mod_cluster/native/mod_manager.
by jbossnative-commits@lists.jboss.org
Author: jfrederic.clere(a)jboss.com
Date: 2008-10-01 10:46:13 -0400 (Wed, 01 Oct 2008)
New Revision: 1924
Modified:
trunk/mod_cluster/native/mod_manager/mod_manager.c
Log:
Accept to recreate the node after removal when it is still here and the same.
Modified: trunk/mod_cluster/native/mod_manager/mod_manager.c
===================================================================
--- trunk/mod_cluster/native/mod_manager/mod_manager.c 2008-10-01 14:24:40 UTC (rev 1923)
+++ trunk/mod_cluster/native/mod_manager/mod_manager.c 2008-10-01 14:46:13 UTC (rev 1924)
@@ -432,7 +432,31 @@
remove_context(mem, &info);
return ret;
}
+/*
+ * Check that the node could be handle as is there were the same.
+ */
+static int is_same_node(nodeinfo_t *nodeinfo, nodeinfo_t *node) {
+ if (strcmp(nodeinfo->mess.balancer,node->mess.balancer))
+ return 0;
+ if (strcmp(nodeinfo->mess.Host, node->mess.Host))
+ return 0;
+ if (strcmp(nodeinfo->mess.Port,node->mess.Port))
+ return 0;
+ if (strcmp(nodeinfo->mess.Type, node->mess.Type))
+ return 0;
+ if (nodeinfo->mess.reversed != node->mess.reversed)
+ return 0;
+ /* Those means the reslist has to be changed */
+ if (nodeinfo->mess.smax != node->mess.smax)
+ return 0;
+ if (nodeinfo->mess.ttl != node->mess.ttl)
+ return 0;
+
+ /* All other fields can be modified without causing problems */
+ return -1;
+}
+
/*
* Process a CONFIG message
* Balancer: <Balancer name>
@@ -649,10 +673,13 @@
/* check for removed node */
node = read_node(nodestatsmem, &nodeinfo);
if (node != NULL && node->mess.remove) {
- /* Here we can't update it because the old one is still in */
- strcpy(node->mess.JVMRoute, "REMOVED");
- *errtype = TYPEMEM;
- return MNODERM;
+ /* If the node is removed and recreated unchanged that is ok: network problems */
+ if (! is_same_node(node, &nodeinfo)) {
+ /* Here we can't update it because the old one is still in */
+ strcpy(node->mess.JVMRoute, "REMOVED");
+ *errtype = TYPEMEM;
+ return MNODERM;
+ }
}
/* Insert or update node description */
16 years, 2 months
JBoss Native SVN: r1923 - trunk/mod_cluster/test/java.
by jbossnative-commits@lists.jboss.org
Author: jfrederic.clere(a)jboss.com
Date: 2008-10-01 10:24:40 -0400 (Wed, 01 Oct 2008)
New Revision: 1923
Modified:
trunk/mod_cluster/test/java/TestHttpClient.java
Log:
Allow to test values for STATUS.
Modified: trunk/mod_cluster/test/java/TestHttpClient.java
===================================================================
--- trunk/mod_cluster/test/java/TestHttpClient.java 2008-10-01 12:39:27 UTC (rev 1922)
+++ trunk/mod_cluster/test/java/TestHttpClient.java 2008-10-01 14:24:40 UTC (rev 1923)
@@ -6,6 +6,7 @@
public static String JVMRoute = System.getProperty("JVMRoute", "node1");
public static String Host = System.getProperty("Host", "localhost");
+ public static String Factor = "50";
/**
*
* Usage:
@@ -18,12 +19,16 @@
*/
public static void main(String[] args) throws Exception
{
- if (args.length != 2)
- {
- System.err.println("missing command line arguments");
- System.exit(1);
+ if (args.length == 2)
+ runit(args[0], args[1]);
+ else if (args.length == 3) {
+ Factor = args[2];
+ System.out.println("Using factor: " + Factor);
+ runit(args[0], args[1]);
+ } else {
+ System.err.println("missing command line arguments");
+ System.exit(1);
}
- runit(args[0], args[1]);
}
public static int runit(String URL, String command) throws Exception
{
@@ -65,9 +70,10 @@
pm = (PostMethod) new DumpMethod(URL);
}
else if (command.compareToIgnoreCase("STATUS")==0) {
+ System.out.println("STATUS factor: " + Factor);
pm = (PostMethod) new StatusMethod(URL);
pm.addParameter("JVMRoute", JVMRoute);
- pm.addParameter("Load", "50");
+ pm.addParameter("Load", Factor);
}
else if (command.compareToIgnoreCase("ERROR")==0) {
pm = (PostMethod) new CauseErrorMethod(URL);
16 years, 2 months
JBoss Native SVN: r1922 - trunk/mod_cluster/src/demo/java/org/jboss/modcluster/demo/servlet.
by jbossnative-commits@lists.jboss.org
Author: pferraro
Date: 2008-10-01 08:39:27 -0400 (Wed, 01 Oct 2008)
New Revision: 1922
Modified:
trunk/mod_cluster/src/demo/java/org/jboss/modcluster/demo/servlet/HeapMemoryLoadServlet.java
Log:
Use half the free memory - instead of all of it.
Modified: trunk/mod_cluster/src/demo/java/org/jboss/modcluster/demo/servlet/HeapMemoryLoadServlet.java
===================================================================
--- trunk/mod_cluster/src/demo/java/org/jboss/modcluster/demo/servlet/HeapMemoryLoadServlet.java 2008-09-30 15:45:58 UTC (rev 1921)
+++ trunk/mod_cluster/src/demo/java/org/jboss/modcluster/demo/servlet/HeapMemoryLoadServlet.java 2008-10-01 12:39:27 UTC (rev 1922)
@@ -42,7 +42,7 @@
{
int duration = Integer.parseInt(this.getParameter(request, DURATION, DEFAULT_DURATION));
- long free = Runtime.getRuntime().freeMemory();
+ long free = Runtime.getRuntime().freeMemory() / 2;
@SuppressWarnings("unused")
Object array = null;
16 years, 2 months