JBoss Native SVN: r1964 - sandbox/mod_jk.
by jbossnative-commits@lists.jboss.org
Author: jfrederic.clere(a)jboss.com
Date: 2008-10-20 07:53:50 -0400 (Mon, 20 Oct 2008)
New Revision: 1964
Added:
sandbox/mod_jk/PongServ.java
Log:
Server to test cping/cpong interaction.
Added: sandbox/mod_jk/PongServ.java
===================================================================
--- sandbox/mod_jk/PongServ.java (rev 0)
+++ sandbox/mod_jk/PongServ.java 2008-10-20 11:53:50 UTC (rev 1964)
@@ -0,0 +1,54 @@
+import java.io.*;
+import java.net.*;
+
+class PongServ {
+ public static void main(String[] argv)
+ {
+ int wait = 3000;
+ if (argv.length == 1)
+ wait = Integer.parseInt(argv[0]);
+ System.out.println("PongServ wait: " + wait);
+ ServerSocket serverSocket = null;
+ try {
+ serverSocket = new ServerSocket(8009);
+ } catch (IOException e) {
+ System.out.println("Could not listen on port: 8009");
+ System.exit(-1);
+ }
+ Socket clientSocket = null;
+ try {
+ clientSocket = serverSocket.accept();
+ } catch (IOException e) {
+ System.out.println("Accept failed: 8009");
+ System.exit(-1);
+ }
+ byte[] buf = new byte[1024];
+ int num;
+ byte cpong[] = { 'A' , 'B', '\0' , (byte)0x02 , (byte)0x09 };
+ InputStream clientInput = null;
+ OutputStream clientOutput = null;
+ try {
+ clientSocket.setSoTimeout(wait);
+ clientInput = clientSocket.getInputStream();
+ clientOutput = clientSocket.getOutputStream();
+ while ((num = clientInput.read(buf)) != -1) {
+ System.out.println(".");
+ }
+ System.out.println("num " + num);
+ } catch (InterruptedIOException e) {
+ e.printStackTrace();
+ } catch (IOException e) {
+ e.printStackTrace();
+ System.out.println("Could not read from port: 8009");
+ System.exit(-1);
+ }
+
+ /* write cpong */
+ try {
+ clientOutput.write(cpong);
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+
+ }
+}
16 years, 3 months
JBoss Native SVN: r1963 - trunk/mod_cluster/test/java/org/jboss/mod_cluster.
by jbossnative-commits@lists.jboss.org
Author: jfrederic.clere(a)jboss.com
Date: 2008-10-17 12:35:49 -0400 (Fri, 17 Oct 2008)
New Revision: 1963
Added:
trunk/mod_cluster/test/java/org/jboss/mod_cluster/TestStickyRemove.java
Modified:
trunk/mod_cluster/test/java/org/jboss/mod_cluster/Client.java
trunk/mod_cluster/test/java/org/jboss/mod_cluster/MyCount.java
Log:
Add a test for StickyRemove (on cookie).
Modified: trunk/mod_cluster/test/java/org/jboss/mod_cluster/Client.java
===================================================================
--- trunk/mod_cluster/test/java/org/jboss/mod_cluster/Client.java 2008-10-17 14:35:30 UTC (rev 1962)
+++ trunk/mod_cluster/test/java/org/jboss/mod_cluster/Client.java 2008-10-17 16:35:49 UTC (rev 1963)
@@ -53,6 +53,7 @@
private String node = null;
public int httpResponseCode = 0;
+ public String requestedSessionId = null;
/*
*
* Usage:
@@ -238,6 +239,13 @@
}
System.out.println("No cookies");
}
+ Header head = bm.getResponseHeader("getRequestedSessionId");
+ if (head != null) {
+ HeaderElement[] heade = head.getElements();
+ requestedSessionId = heade[0].getValue();
+ } else {
+ requestedSessionId = null;
+ }
} else {
System.out.println("Not 200");
success = false;
Modified: trunk/mod_cluster/test/java/org/jboss/mod_cluster/MyCount.java
===================================================================
--- trunk/mod_cluster/test/java/org/jboss/mod_cluster/MyCount.java 2008-10-17 14:35:30 UTC (rev 1962)
+++ trunk/mod_cluster/test/java/org/jboss/mod_cluster/MyCount.java 2008-10-17 16:35:49 UTC (rev 1963)
@@ -55,7 +55,6 @@
out.println("<body>");
out.println("<h3>" + title + "</h3>");
-
HttpSession session = request.getSession(false);
Integer ii = new Integer(0);
if (session == null) {
@@ -128,6 +127,10 @@
out.println("</body>");
out.println("</html>");
+
+ /* Use headers */
+ response.setHeader("RequestedSessionId", request.getRequestedSessionId());
+
}
public void doPost(HttpServletRequest request,
Added: trunk/mod_cluster/test/java/org/jboss/mod_cluster/TestStickyRemove.java
===================================================================
--- trunk/mod_cluster/test/java/org/jboss/mod_cluster/TestStickyRemove.java (rev 0)
+++ trunk/mod_cluster/test/java/org/jboss/mod_cluster/TestStickyRemove.java 2008-10-17 16:35:49 UTC (rev 1963)
@@ -0,0 +1,159 @@
+/*
+ * mod_cluster
+ *
+ * Copyright(c) 2008 Red Hat Middleware, LLC,
+ * and individual contributors as indicated by the @authors tag.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library in the file COPYING.LIB;
+ * if not, write to the Free Software Foundation, Inc.,
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ *
+ * @author Jean-Frederic Clere
+ * @version $Revision$
+ */
+
+package org.jboss.mod_cluster;
+
+import java.io.IOException;
+
+import junit.framework.TestCase;
+
+import org.apache.catalina.Engine;
+import org.apache.catalina.ServerFactory;
+import org.apache.catalina.Service;
+import org.apache.catalina.LifecycleListener;
+import org.apache.catalina.LifecycleException;
+import org.apache.catalina.connector.Connector;
+import org.apache.catalina.core.StandardServer;
+
+public class TestStickyRemove extends TestCase {
+
+ StandardServer server = null;
+
+ /* Test failover */
+ public void testStickyRemove() {
+
+ boolean clienterror = false;
+ server = Maintest.getServer();
+ JBossWeb service = null;
+ JBossWeb service2 = null;
+ Connector connector = null;
+ Connector connector2 = null;
+ LifecycleListener cluster = null;
+ try {
+ // server = (StandardServer) ServerFactory.getServer();
+
+ service = new JBossWeb("node3", "localhost");
+ connector = service.addConnector(8009);
+ server.addService(service);
+
+ service2 = new JBossWeb("node4", "localhost");
+ connector2 = service2.addConnector(8889);
+ server.addService(service2);
+
+ cluster = Maintest.createClusterListener("232.0.0.2", 23364, false, null, true, true, false);
+ server.addLifecycleListener(cluster);
+ Maintest.listServices();
+
+ } catch(IOException ex) {
+ ex.printStackTrace();
+ fail("can't start service");
+ }
+
+ // start the server thread.
+ ServerThread wait = new ServerThread(3000, server);
+ wait.start();
+
+ // Wait until httpd as received the nodes information.
+ try {
+ Thread.sleep(30000);
+ } catch (InterruptedException ex) {
+ ex.printStackTrace();
+ }
+
+ // Start the client and wait for it.
+ Client client = new Client();
+
+ // Wait for it.
+ try {
+ if (client.runit("http://localhost:7779/ROOT/MyCount", 10, false, true) != 0)
+ clienterror = true;
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ clienterror = true;
+ }
+
+ // Stop the connector that has received the request...
+ String node = client.getnode();
+ if ("node4".equals(node)) {
+ connector = connector2;
+ node = "node3";
+ } else {
+ node = "node4";
+ }
+ if (connector != null) {
+ try {
+ connector.stop();
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ fail("can't stop connector");
+ }
+ }
+
+ if (clienterror)
+ fail("Client error");
+
+ // Run a test on it. (it waits until httpd as received the nodes information).
+ client.setnode(node);
+ try {
+ client.setdelay(30000);
+ client.start();
+ client.join();
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ }
+ if (client.getresultok())
+ System.out.println("Test DONE");
+ else {
+ System.out.println("Test FAILED");
+ clienterror = true;
+ }
+
+ // Stop the server or services.
+ try {
+ wait.stopit();
+ wait.join();
+ server.removeService(service);
+ server.removeService(service2);
+ server.removeLifecycleListener(cluster);
+ } catch (InterruptedException ex) {
+ ex.printStackTrace();
+ }
+
+ // Wait until httpd as received the stop messages.
+ try {
+ Thread.sleep(5000);
+ } catch (InterruptedException ex) {
+ ex.printStackTrace();
+ }
+
+ // Test client result.
+ if (clienterror)
+ fail("Client test failed");
+ if (client.requestedSessionId != null)
+ fail("Client client received a sessionid");
+ }
+}
16 years, 3 months
JBoss Native SVN: r1962 - trunk/mod_cluster/native/mod_proxy_cluster.
by jbossnative-commits@lists.jboss.org
Author: jfrederic.clere(a)jboss.com
Date: 2008-10-17 10:35:30 -0400 (Fri, 17 Oct 2008)
New Revision: 1962
Modified:
trunk/mod_cluster/native/mod_proxy_cluster/mod_proxy_cluster.c
Log:
Arrange domain handling...
Modified: trunk/mod_cluster/native/mod_proxy_cluster/mod_proxy_cluster.c
===================================================================
--- trunk/mod_cluster/native/mod_proxy_cluster/mod_proxy_cluster.c 2008-10-17 13:36:29 UTC (rev 1961)
+++ trunk/mod_cluster/native/mod_proxy_cluster/mod_proxy_cluster.c 2008-10-17 14:35:30 UTC (rev 1962)
@@ -847,7 +847,7 @@
if (mycandidate) {
/* Failover in domain */
if (!checked_domain)
- apr_table_setn(r->notes, "session-domain_over", "1");
+ apr_table_setn(r->notes, "session-domain-ok", "1");
mycandidate->s->elected++;
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
"proxy: byrequests balancer DONE (%s)", mycandidate->name);
@@ -1383,11 +1383,15 @@
/* Read the domain in case we have to make a failover */
rv = node_storage->find_node(&ou, *route);
if (rv == APR_SUCCESS) {
- ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
- "proxy: Found domain %s for %s", ou->mess.Domain, *route);
- apr_table_setn(r->notes, "session-domain", ou->mess.Domain);
- if (domain)
- *domain = ou->mess.Domain;
+ if (ou->mess.Domain[0] != '\0') {
+ ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
+ "proxy: Found domain %s for %s", ou->mess.Domain, *route);
+ if (domain)
+ *domain = ou->mess.Domain;
+ } else {
+ if (domain)
+ *domain = NULL;
+ }
}
/* We have a route in path or in cookie
* Find the worker that has this route defined.
@@ -1649,7 +1653,7 @@
"proxy: CLUSTER: (%s). Unlock failed for pre_request",
(*balancer)->name);
}
- return HTTP_SERVICE_UNAVAILABLE;
+ return HTTP_SERVICE_UNAVAILABLE;
} else {
/* We try to to failover using another node in the domain */
failoverdomain = 1;
16 years, 3 months
JBoss Native SVN: r1961 - trunk/mod_cluster/test/java/org/jboss/mod_cluster.
by jbossnative-commits@lists.jboss.org
Author: jfrederic.clere(a)jboss.com
Date: 2008-10-17 09:36:29 -0400 (Fri, 17 Oct 2008)
New Revision: 1961
Added:
trunk/mod_cluster/test/java/org/jboss/mod_cluster/TestStickyForce.java
Modified:
trunk/mod_cluster/test/java/org/jboss/mod_cluster/Client.java
trunk/mod_cluster/test/java/org/jboss/mod_cluster/Maintest.java
Log:
Add a test to make sure that there is no failover when configured so.
Modified: trunk/mod_cluster/test/java/org/jboss/mod_cluster/Client.java
===================================================================
--- trunk/mod_cluster/test/java/org/jboss/mod_cluster/Client.java 2008-10-17 11:44:06 UTC (rev 1960)
+++ trunk/mod_cluster/test/java/org/jboss/mod_cluster/Client.java 2008-10-17 13:36:29 UTC (rev 1961)
@@ -51,6 +51,8 @@
private boolean checknode = true;
private boolean success = true;
private String node = null;
+
+ public int httpResponseCode = 0;
/*
*
* Usage:
@@ -172,7 +174,6 @@
bm.setRequestHeader("Cookie", "JSESSIONID=" + jsessionid);
}
- int httpResponseCode = 0;
try {
if (gm == null) {
httpResponseCode = httpClient.executeMethod(pm);
Modified: trunk/mod_cluster/test/java/org/jboss/mod_cluster/Maintest.java
===================================================================
--- trunk/mod_cluster/test/java/org/jboss/mod_cluster/Maintest.java 2008-10-17 11:44:06 UTC (rev 1960)
+++ trunk/mod_cluster/test/java/org/jboss/mod_cluster/Maintest.java 2008-10-17 13:36:29 UTC (rev 1961)
@@ -81,6 +81,8 @@
System.gc();
suite.addTest(new TestSuite(TestFailover.class));
System.gc();
+ suite.addTest(new TestSuite(TestStickyForce.class));
+ System.gc();
suite.addTest(new TestSuite(TestJBWEB_117.class));
System.gc();
suite.addTest(new TestSuite(Test_Native_JBWEB_117.class));
Added: trunk/mod_cluster/test/java/org/jboss/mod_cluster/TestStickyForce.java
===================================================================
--- trunk/mod_cluster/test/java/org/jboss/mod_cluster/TestStickyForce.java (rev 0)
+++ trunk/mod_cluster/test/java/org/jboss/mod_cluster/TestStickyForce.java 2008-10-17 13:36:29 UTC (rev 1961)
@@ -0,0 +1,157 @@
+/*
+ * mod_cluster
+ *
+ * Copyright(c) 2008 Red Hat Middleware, LLC,
+ * and individual contributors as indicated by the @authors tag.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library in the file COPYING.LIB;
+ * if not, write to the Free Software Foundation, Inc.,
+ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
+ *
+ * @author Jean-Frederic Clere
+ * @version $Revision$
+ */
+
+package org.jboss.mod_cluster;
+
+import java.io.IOException;
+
+import junit.framework.TestCase;
+
+import org.apache.catalina.Engine;
+import org.apache.catalina.ServerFactory;
+import org.apache.catalina.Service;
+import org.apache.catalina.LifecycleListener;
+import org.apache.catalina.LifecycleException;
+import org.apache.catalina.connector.Connector;
+import org.apache.catalina.core.StandardServer;
+
+public class TestStickyForce extends TestCase {
+
+ StandardServer server = null;
+
+ /* Test failover */
+ public void testStickyForce() {
+
+ boolean clienterror = false;
+ server = Maintest.getServer();
+ JBossWeb service = null;
+ JBossWeb service2 = null;
+ Connector connector = null;
+ Connector connector2 = null;
+ LifecycleListener cluster = null;
+ try {
+ // server = (StandardServer) ServerFactory.getServer();
+
+ service = new JBossWeb("node3", "localhost");
+ connector = service.addConnector(8009);
+ server.addService(service);
+
+ service2 = new JBossWeb("node4", "localhost");
+ connector2 = service2.addConnector(8888);
+ server.addService(service2);
+
+ cluster = Maintest.createClusterListener("232.0.0.2", 23364, false);
+ server.addLifecycleListener(cluster);
+ Maintest.listServices();
+
+ } catch(IOException ex) {
+ ex.printStackTrace();
+ fail("can't start service");
+ }
+
+ // start the server thread.
+ ServerThread wait = new ServerThread(3000, server);
+ wait.start();
+
+ // Wait until httpd as received the nodes information.
+ try {
+ Thread.sleep(30000);
+ } catch (InterruptedException ex) {
+ ex.printStackTrace();
+ }
+
+ // Start the client and wait for it.
+ Client client = new Client();
+
+ // Wait for it.
+ try {
+ if (client.runit("http://localhost:7779/ROOT/MyCount", 10, false, true) != 0)
+ clienterror = true;
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ clienterror = true;
+ }
+
+ // Stop the connector that has received the request...
+ String node = client.getnode();
+ if ("node4".equals(node)) {
+ connector = connector2;
+ node = "node3";
+ } else {
+ node = "node4";
+ }
+ if (connector != null) {
+ try {
+ connector.stop();
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ fail("can't stop connector");
+ }
+ }
+
+ if (clienterror)
+ fail("Client error");
+
+ // Run a test on it. (it waits until httpd as received the nodes information).
+ client.setnode(node);
+ try {
+ client.setdelay(30000);
+ client.start();
+ client.join();
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ }
+ if (client.getresultok())
+ System.out.println("Test DONE");
+ else {
+ System.out.println("Test FAILED");
+ clienterror = true;
+ }
+
+ // Stop the server or services.
+ try {
+ wait.stopit();
+ wait.join();
+ server.removeService(service);
+ server.removeService(service2);
+ server.removeLifecycleListener(cluster);
+ } catch (InterruptedException ex) {
+ ex.printStackTrace();
+ }
+
+ // Wait until httpd as received the stop messages.
+ try {
+ Thread.sleep(5000);
+ } catch (InterruptedException ex) {
+ ex.printStackTrace();
+ }
+
+ // Test client result.
+ if ( !clienterror && client.httpResponseCode != 503 )
+ fail("Client test should have failed");
+ }
+}
16 years, 3 months
JBoss Native SVN: r1960 - trunk/mod_cluster/test/java/org/jboss/mod_cluster.
by jbossnative-commits@lists.jboss.org
Author: jfrederic.clere(a)jboss.com
Date: 2008-10-17 07:44:06 -0400 (Fri, 17 Oct 2008)
New Revision: 1960
Modified:
trunk/mod_cluster/test/java/org/jboss/mod_cluster/JBossWeb.java
trunk/mod_cluster/test/java/org/jboss/mod_cluster/Maintest.java
trunk/mod_cluster/test/java/org/jboss/mod_cluster/TestFailover.java
Log:
Arrange the Failover tests.
Modified: trunk/mod_cluster/test/java/org/jboss/mod_cluster/JBossWeb.java
===================================================================
--- trunk/mod_cluster/test/java/org/jboss/mod_cluster/JBossWeb.java 2008-10-17 11:42:06 UTC (rev 1959)
+++ trunk/mod_cluster/test/java/org/jboss/mod_cluster/JBossWeb.java 2008-10-17 11:44:06 UTC (rev 1960)
@@ -172,15 +172,15 @@
copyFile(fdin, fd);
}
- public void addConnector(int port) throws IOException {
- addConnector(port, "http");
+ public Connector addConnector(int port) throws IOException {
+ return addConnector(port, "ajp");
}
- public void addConnector(int port, String scheme) throws IOException {
- addConnector(port, scheme, null);
+ public Connector addConnector(int port, String scheme) throws IOException {
+ return addConnector(port, scheme, null);
}
- public void addConnector(int port, String scheme, String address) throws IOException {
+ public Connector addConnector(int port, String scheme, String address) throws IOException {
Connector connector = createConnector( address,
@@ -188,6 +188,8 @@
// Look in StandardService to see why it works ;-)
addConnector( connector );
+
+ return connector;
}
Modified: trunk/mod_cluster/test/java/org/jboss/mod_cluster/Maintest.java
===================================================================
--- trunk/mod_cluster/test/java/org/jboss/mod_cluster/Maintest.java 2008-10-17 11:42:06 UTC (rev 1959)
+++ trunk/mod_cluster/test/java/org/jboss/mod_cluster/Maintest.java 2008-10-17 11:44:06 UTC (rev 1960)
@@ -115,6 +115,11 @@
return createClusterListener(groupa, groupp, ssl, null);
}
static LifecycleListener createClusterListener(String groupa, int groupp, boolean ssl, String domain) {
+ return createClusterListener(groupa, groupp, ssl, domain, true, false, true);
+ }
+ static LifecycleListener createClusterListener(String groupa, int groupp, boolean ssl, String domain,
+ boolean stickySession, boolean stickySessionRemove,
+ boolean stickySessionForce) {
LifecycleListener lifecycle = null;
ClusterListener jcluster = null;
org.jboss.modcluster.ClusterListener pcluster = null;
@@ -125,6 +130,9 @@
jcluster.setAdvertisePort(groupp);
jcluster.setSsl(ssl);
jcluster.setDomain(domain);
+ jcluster.setStickySession(stickySession);
+ jcluster.setStickySessionRemove(stickySessionRemove);
+ jcluster.setStickySessionForce(stickySessionForce);
lifecycle = jcluster;
} else {
pcluster = new org.jboss.modcluster.ClusterListener();
@@ -132,6 +140,9 @@
pcluster.setAdvertisePort(groupp);
pcluster.setSsl(ssl);
pcluster.setDomain(domain);
+ pcluster.setStickySession(stickySession);
+ pcluster.setStickySessionRemove(stickySessionRemove);
+ pcluster.setStickySessionForce(stickySessionForce);
lifecycle = pcluster;
}
Modified: trunk/mod_cluster/test/java/org/jboss/mod_cluster/TestFailover.java
===================================================================
--- trunk/mod_cluster/test/java/org/jboss/mod_cluster/TestFailover.java 2008-10-17 11:42:06 UTC (rev 1959)
+++ trunk/mod_cluster/test/java/org/jboss/mod_cluster/TestFailover.java 2008-10-17 11:44:06 UTC (rev 1960)
@@ -49,14 +49,21 @@
boolean clienterror = false;
server = Maintest.getServer();
JBossWeb service = null;
+ JBossWeb service2 = null;
+ Connector connector = null;
+ Connector connector2 = null;
LifecycleListener cluster = null;
try {
// server = (StandardServer) ServerFactory.getServer();
service = new JBossWeb("node3", "localhost");
- service.addConnector(8009);
+ connector = service.addConnector(8009);
server.addService(service);
+ service2 = new JBossWeb("node4", "localhost");
+ connector2 = service2.addConnector(8000);
+ server.addService(service2);
+
cluster = Maintest.createClusterListener("232.0.0.2", 23364, false, "dom1");
server.addLifecycleListener(cluster);
Maintest.listServices();
@@ -89,40 +96,28 @@
clienterror = true;
}
- // Stop jboss.
- try {
- wait.stopit();
- wait.join();
- server.removeService(service);
- server.removeLifecycleListener(cluster);
- } catch (InterruptedException ex) {
- ex.printStackTrace();
- fail("can't stop server");
+ // Stop the connector that has received the request...
+ String node = client.getnode();
+ if ("node4".equals(node)) {
+ connector = connector2;
+ node = "node3";
+ } else {
+ node = "node4";
}
+ if (connector != null) {
+ try {
+ connector.stop();
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ fail("can't stop connector");
+ }
+ }
if (clienterror)
fail("Client error");
- // Start a new one.
- try {
- service = new JBossWeb("node4", "localhost");
- service.addConnector(8000);
- server.addService(service);
-
- cluster = Maintest.createClusterListener("232.0.0.2", 23364, false);
- server.addLifecycleListener(cluster);
-
- } catch(IOException ex) {
- ex.printStackTrace();
- fail("Server start() failed");
- }
-
- // Start a server thread.
- wait = new ServerThread(3000, server);
- wait.start();
-
// Run a test on it. (it waits until httpd as received the nodes information).
- client.setnode("node4");
+ client.setnode(node);
try {
client.setdelay(30000);
client.start();
16 years, 3 months
JBoss Native SVN: r1959 - in trunk/mod_cluster/native: mod_manager and 1 other directories.
by jbossnative-commits@lists.jboss.org
Author: jfrederic.clere(a)jboss.com
Date: 2008-10-17 07:42:06 -0400 (Fri, 17 Oct 2008)
New Revision: 1959
Modified:
trunk/mod_cluster/native/include/mod_proxy_cluster.h
trunk/mod_cluster/native/include/node.h
trunk/mod_cluster/native/mod_manager/mod_manager.c
trunk/mod_cluster/native/mod_proxy_cluster/mod_proxy_cluster.c
Log:
Add missing logic for the StickySessionRemove.
Arrange node removal.
Modified: trunk/mod_cluster/native/include/mod_proxy_cluster.h
===================================================================
--- trunk/mod_cluster/native/include/mod_proxy_cluster.h 2008-10-16 08:15:45 UTC (rev 1958)
+++ trunk/mod_cluster/native/include/mod_proxy_cluster.h 2008-10-17 11:42:06 UTC (rev 1959)
@@ -27,6 +27,12 @@
#ifndef MOD_PROXY_CLUSTER_H
#define MOD_PROXY_CLUSTER_H
+
+/* define the values for sticky_force */
+#define STSESSION 0x01 /* Use sticky session logic (first sessionid and then domain) */
+#define STSESSREM 0x02 /* Remove session information if the failover can't use sticky */
+#define STSESSFOR 0x04 /* Force sticky (return error if no worker corresponds to sessionid or domain) */
+
struct balancer_method {
/**
* Check that the node is responding
Modified: trunk/mod_cluster/native/include/node.h
===================================================================
--- trunk/mod_cluster/native/include/node.h 2008-10-16 08:15:45 UTC (rev 1958)
+++ trunk/mod_cluster/native/include/node.h 2008-10-17 11:42:06 UTC (rev 1959)
@@ -69,6 +69,7 @@
int id; /* id in table and worker id */
apr_time_t updatetimelb; /* time of last update of the lbstatus value */
int oldelected; /* value of s->elected when calculating the lbstatus */
+ apr_time_t lastcleantry; /* time of last unsuccessful try to clean the worker in proxy part */
};
typedef struct nodemess nodemess_t;
@@ -203,7 +204,7 @@
/*
* Find the node using the JVMRoute information
*/
-int (*find_node)(nodeinfo_t **node, const char *route);
+apr_status_t (*find_node)(nodeinfo_t **node, const char *route);
/*
* Lock the whole node table
*/
Modified: trunk/mod_cluster/native/mod_manager/mod_manager.c
===================================================================
--- trunk/mod_cluster/native/mod_manager/mod_manager.c 2008-10-16 08:15:45 UTC (rev 1958)
+++ trunk/mod_cluster/native/mod_manager/mod_manager.c 2008-10-17 11:42:06 UTC (rev 1959)
@@ -531,6 +531,7 @@
nodeinfo.mess.ttl = apr_time_from_sec(60);
nodeinfo.mess.timeout = 0;
nodeinfo.mess.id = 0;
+ nodeinfo.mess.lastcleantry = 0;
/* Fill default balancer values */
memset(&balancerinfo, '\0', sizeof(balancerinfo));
Modified: trunk/mod_cluster/native/mod_proxy_cluster/mod_proxy_cluster.c
===================================================================
--- trunk/mod_cluster/native/mod_proxy_cluster/mod_proxy_cluster.c 2008-10-16 08:15:45 UTC (rev 1958)
+++ trunk/mod_cluster/native/mod_proxy_cluster/mod_proxy_cluster.c 2008-10-17 11:42:06 UTC (rev 1959)
@@ -116,6 +116,7 @@
}
reuse = 1;
} else {
+ /* XXX: (*worker)->id ?= node->mess.id; */
return; /* Done Already existing */
}
@@ -148,6 +149,7 @@
(*worker)->keepalive_set = 1;
(*worker)->is_address_reusable = 1;
(*worker)->acquire = apr_time_make(0, 2 * 1000); /* 2 ms */
+ (*worker)->retry = apr_time_from_sec(PROXY_WORKER_DEFAULT_RETRY);
/*
* The Shared datastatus may already contains a valid information
@@ -229,7 +231,13 @@
/* XXX: StickySession, StickySessionRemove not in */
balancer->sticky = apr_psprintf(conf->pool, "%s|%s", balan->StickySessionCookie,
balan->StickySessionPath);
- balancer->sticky_force = balan->StickySessionForce;
+ balancer->sticky_force = 0;
+ if (balan->StickySession)
+ balancer->sticky_force += STSESSION;
+ if (balan->StickySessionForce)
+ balancer->sticky_force += STSESSFOR;
+ if (balan->StickySessionRemove)
+ balancer->sticky_force += STSESSREM;
balancer->timeout = balan->Timeout;
balancer->max_attempts = balan->Maxattempts;
@@ -310,8 +318,10 @@
worker->id = 0; /* mark it removed */
return (0);
- } else
+ } else {
+ node->mess.lastcleantry = apr_time_now();
return (1); /* We should retry later */
+ }
}
/*
* Create/Remove workers corresponding to updated nodes.
@@ -746,8 +756,8 @@
* stopped in one node but not in others.
* We also try the domain.
*/
-static proxy_worker *find_best_byrequests(proxy_balancer *balancer,
- request_rec *r)
+static proxy_worker *internal_find_best_byrequests(proxy_balancer *balancer,
+ request_rec *r, char *domain, int failoverdomain)
{
int i;
proxy_worker *worker;
@@ -756,7 +766,6 @@
int checked_standby = 0;
int checked_domain = 1;
void *sconf = r->server->module_config;
- const char *domain = apr_table_get(r->notes, "session-domain");
proxy_server_conf *conf = (proxy_server_conf *)
ap_get_module_config(sconf, &proxy_module);
@@ -770,7 +779,7 @@
/* First try to see if we have available candidate */
if (domain && strlen(domain)>0)
checked_domain = 0;
- while (!mycandidate && !checked_standby) {
+ while (!checked_standby) {
worker = (proxy_worker *)balancer->workers->elts;
for (i = 0; i < balancer->workers->nelts; i++, worker++) {
nodeinfo_t *node;
@@ -794,7 +803,9 @@
* not in error state or not disabled.
* and that can map the context.
*/
- node_storage->read_node(worker->id, &node);
+ if (node_storage->read_node(worker->id, &node) != APR_SUCCESS)
+ continue; /* Can't read node */
+
if (PROXY_WORKER_IS_USABLE(worker) && iscontext_host_ok(r, balancer, node)) {
if (!checked_domain) {
/* First try only nodes in the domain */
@@ -823,13 +834,20 @@
}
}
}
+ if (mycandidate)
+ break;
if (checked_domain) {
+ if (failoverdomain)
+ break; /* We only failover in the domain */
checked_standby = checking_standby++;
}
checked_domain++;
}
if (mycandidate) {
+ /* Failover in domain */
+ if (!checked_domain)
+ apr_table_setn(r->notes, "session-domain_over", "1");
mycandidate->s->elected++;
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
"proxy: byrequests balancer DONE (%s)", mycandidate->name);
@@ -839,6 +857,11 @@
}
return mycandidate;
}
+static proxy_worker *find_best_byrequests(proxy_balancer *balancer,
+ request_rec *r)
+{
+ return (internal_find_best_byrequests(balancer, r, NULL, 0));
+}
static const proxy_balancer_method byrequests =
{
"byrequests",
@@ -1109,7 +1132,7 @@
/*
* Remove node that have beeen marked removed for more than 10 seconds.
*/
-static void remove_removed_node(apr_pool_t *pool)
+static void remove_removed_node(apr_pool_t *pool, server_rec *server)
{
int *id, size, i;
apr_time_t now = apr_time_now();
@@ -1120,7 +1143,8 @@
for (i=0; i<size; i++) {
nodeinfo_t *ou;
node_storage->read_node(id[i], &ou);
- if (ou->mess.remove && (now - ou->updatetime) >= apr_time_from_sec(WAITFORREMOVE)) {
+ if (ou->mess.remove && (now - ou->updatetime) >= apr_time_from_sec(WAITFORREMOVE) &&
+ (now - ou->mess.lastcleantry) >= apr_time_from_sec(WAITFORREMOVE)) {
/* remove the node from the shared memory */
node_storage->remove_node(ou);
}
@@ -1140,7 +1164,7 @@
/* Create new workers if the shared memory changes */
update_workers_node(conf, pool, s);
/* cleanup removed node in shared memory */
- remove_removed_node(pool);
+ remove_removed_node(pool, s);
/* Calculate the lbstatus for each node */
update_workers_lbstatus(conf, pool, s);
apr_pool_destroy(pool);
@@ -1242,17 +1266,15 @@
* Find the worker that has the 'route' defined
* (Should we also find the domain corresponding to it).
*/
-static proxy_worker *find_route_worker(proxy_balancer *balancer,
- const char *route, request_rec *r)
+static proxy_worker *find_route_worker(request_rec *r,
+ proxy_balancer *balancer,
+ const char *route)
{
int i;
int checking_standby;
int checked_standby;
proxy_worker *worker;
- nodeinfo_t *ou;
- char *domain;
- apr_status_t rv;
checking_standby = checked_standby = 0;
while (!checked_standby) {
@@ -1289,7 +1311,7 @@
*/
if (*worker->s->redirect) {
proxy_worker *rworker = NULL;
- rworker = find_route_worker(balancer, worker->s->redirect, r);
+ rworker = find_route_worker(r, balancer, worker->s->redirect);
/* Check if the redirect worker is usable */
if (rworker && !PROXY_WORKER_IS_USABLE(rworker)) {
/*
@@ -1310,13 +1332,6 @@
}
checked_standby = checking_standby++;
}
- /* We don't find a worker try to locate the domain for a fail-over */
- rv = node_storage->find_node(&ou, route);
- if (rv == APR_SUCCESS) {
- ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
- "proxy: Found domain %s for %s", ou->mess.Domain, route);
- apr_table_setn(r->notes, "session-domain", ou->mess.Domain);
- }
return NULL;
}
@@ -1327,13 +1342,17 @@
request_rec *r,
char **route,
char **sticky_used,
- char **url)
+ char **url,
+ char **domain)
{
proxy_worker *worker = NULL;
char *sticky, *sticky_path, *path;
if (!balancer->sticky)
return NULL;
+ if (! (balancer->sticky_force & STSESSION))
+ return NULL;
+
sticky = sticky_path = apr_pstrdup(r->pool, balancer->sticky);
if ((path = strchr(sticky, '|'))) {
*path++ = '\0';
@@ -1357,12 +1376,23 @@
if ((*route) && ((*route = strchr(*route, '.')) != NULL ))
(*route)++;
if ((*route) && (**route)) {
+ nodeinfo_t *ou;
+ apr_status_t rv;
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
"proxy: CLUSTER: Found route %s", *route);
+ /* Read the domain in case we have to make a failover */
+ rv = node_storage->find_node(&ou, *route);
+ if (rv == APR_SUCCESS) {
+ ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
+ "proxy: Found domain %s for %s", ou->mess.Domain, *route);
+ apr_table_setn(r->notes, "session-domain", ou->mess.Domain);
+ if (domain)
+ *domain = ou->mess.Domain;
+ }
/* We have a route in path or in cookie
* Find the worker that has this route defined.
*/
- worker = find_route_worker(balancer, *route, r);
+ worker = find_route_worker(r, balancer, *route);
if (worker && strcmp(*route, worker->s->route)) {
/*
* Notice that the route of the worker chosen is different from
@@ -1380,7 +1410,7 @@
}
static proxy_worker *find_best_worker(proxy_balancer *balancer,
- request_rec *r)
+ request_rec *r, char *domain, int failoverdomain)
{
proxy_worker *candidate = NULL;
apr_status_t rv;
@@ -1391,7 +1421,8 @@
return NULL;
}
- candidate = (*balancer->lbmethod->finder)(balancer, r);
+ /* XXX: candidate = (*balancer->lbmethod->finder)(balancer, r); */
+ candidate = internal_find_best_byrequests(balancer, r, domain, failoverdomain);
if (candidate) {
proxy_cluster_helper *helper;
@@ -1429,7 +1460,7 @@
while (tval < timeout) {
apr_sleep(step);
/* Try again */
- if ((candidate = find_best_worker(balancer, r)))
+ if ((candidate = find_best_worker(balancer, r, domain, failoverdomain)))
break;
tval += step;
}
@@ -1463,6 +1494,76 @@
}
/*
+ * Remove the session information
+ */
+void remove_session_route(request_rec *r, const char *name)
+{
+ char *path = NULL;
+ char *url = r->filename;
+ char *start = NULL;
+ char *cookies;
+ const char *readcookies;
+ char *start_cookie;
+
+ /* First try to manipulate the url. */
+ for (path = strstr(url, name); path; path = strstr(path + 1, name)) {
+ start = path;
+ if (*(start-1) == '&')
+ start--;
+ path += strlen(name);
+ if (*path == '=') {
+ ++path;
+ if (strlen(path)) {
+ char *filename = r->filename;
+ while (*path !='&' || *path !='\0')
+ path++;
+ /* We have it */
+ *start = '\0';
+ r->filename = apr_pstrcat(r->pool, filename, path, NULL);
+ return;
+ }
+ }
+ }
+ /* Second try to manipulate the cookie header... */
+
+ if ((readcookies = apr_table_get(r->headers_in, "Cookie"))) {
+ cookies = apr_pstrdup(r->pool, readcookies);
+ for (start_cookie = ap_strstr(cookies, name); start_cookie;
+ start_cookie = ap_strstr(start_cookie + 1, name)) {
+ if (start_cookie == cookies ||
+ start_cookie[-1] == ';' ||
+ start_cookie[-1] == ',' ||
+ isspace(start_cookie[-1])) {
+
+ start = start_cookie;
+ if (start_cookie != cookies &&
+ (start_cookie[-1] == ';' || start_cookie[-1] == ',' || isspace(start_cookie[-1]))) {
+ start--;
+ }
+ start_cookie += strlen(name);
+ while(*start_cookie && isspace(*start_cookie))
+ ++start_cookie;
+ if (*start_cookie == '=' && start_cookie[1]) {
+ /*
+ * Session cookie was found, get it's value
+ */
+ char *end_cookie;
+ char *cookie;
+ ++start_cookie;
+ if ((end_cookie = ap_strchr(start_cookie, ';')) == NULL)
+ end_cookie = ap_strchr(start_cookie, ',');
+
+ cookie = cookies;
+ *start = '\0';
+ cookies = apr_pstrcat(r->pool, cookie , end_cookie, NULL);
+ apr_table_setn(r->headers_in, "Cookie", cookies);
+ }
+ }
+ }
+ }
+}
+
+/*
* Find a worker for mod_proxy logic
*/
static int proxy_cluster_pre_request(proxy_worker **worker,
@@ -1474,6 +1575,8 @@
proxy_worker *runtime;
char *route = NULL;
char *sticky = NULL;
+ char *domain = NULL;
+ int failoverdomain = 0;
apr_status_t rv;
*worker = NULL;
@@ -1482,6 +1585,23 @@
* If balancer is already provided skip the search
* for balancer, because this is failover attempt.
*/
+ if (*balancer) {
+ /* Adjust the helper->count corresponding to the previous try */
+ const char *domain = apr_table_get(r->subprocess_env, "BALANCER_WORKER_NAME");
+ if (domain && *domain) {
+ int i;
+ runtime = (proxy_worker *)(*balancer)->workers->elts;
+ for (i = 0; i < (*balancer)->workers->nelts; i++, runtime++) {
+ if (runtime->name && strcmp(domain, runtime->name) == 0) {
+ proxy_cluster_helper *helper;
+ helper = (proxy_cluster_helper *) (runtime)->opaque;
+ if (helper->count_active>0)
+ helper->count_active--;
+ }
+ }
+ }
+ }
+
apr_thread_mutex_lock(lock);
if (!*balancer &&
!(*balancer = ap_proxy_get_balancer(r->pool, conf, *url))) {
@@ -1498,7 +1618,7 @@
/* Step 2: find the session route */
- runtime = find_session_route(*balancer, r, &route, &sticky, url);
+ runtime = find_session_route(*balancer, r, &route, &sticky, url, &domain);
apr_thread_mutex_unlock(lock);
/* Lock the LoadBalancer
@@ -1514,23 +1634,13 @@
runtime->s->elected++;
*worker = runtime;
}
- else if (route && (*balancer)->sticky_force) {
- int i, member_of = 0;
- proxy_worker *workers;
- /*
- * We have a route provided that doesn't match the
- * balancer name. See if the provider route is the
- * member of the same balancer in which case return 503
- */
- workers = (proxy_worker *)(*balancer)->workers->elts;
- for (i = 0; i < (*balancer)->workers->nelts; i++) {
- if (*(workers->s->route) && strcmp(workers->s->route, route) == 0) {
- member_of = 1;
- break;
- }
- workers++;
- }
- if (member_of) {
+ else if (route && ((*balancer)->sticky_force & STSESSFOR)) {
+ if (domain == NULL) {
+ /*
+ * We have a route provided that doesn't match the
+ * balancer name. See if the provider route is the
+ * member of the same balancer in which case return 503
+ */
ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server,
"proxy: CLUSTER: (%s). All workers are in error state for route (%s)",
(*balancer)->name, route);
@@ -1539,7 +1649,10 @@
"proxy: CLUSTER: (%s). Unlock failed for pre_request",
(*balancer)->name);
}
- return HTTP_SERVICE_UNAVAILABLE;
+ return HTTP_SERVICE_UNAVAILABLE;
+ } else {
+ /* We try to to failover using another node in the domain */
+ failoverdomain = 1;
}
}
@@ -1555,7 +1668,10 @@
(*balancer)->name);
}
if (!*worker) {
- runtime = find_best_worker(*balancer, r);
+ /*
+ * We have to failover (in domain only may be) or we don't use sticky sessions
+ */
+ runtime = find_best_worker(*balancer, r, domain, failoverdomain);
if (!runtime) {
ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server,
"proxy: CLUSTER: (%s). All workers are in error state",
@@ -1574,6 +1690,15 @@
*/
apr_table_setn(r->subprocess_env, "BALANCER_ROUTE_CHANGED", "1");
}
+ if (route && ((*balancer)->sticky_force & STSESSREM)) {
+ /*
+ * Failover to another domain. Remove sessionid information.
+ */
+ const char *domain = apr_table_get(r->notes, "session-domain-ok");
+ if (!domain) {
+ remove_session_route(r, sticky);
+ }
+ }
*worker = runtime;
}
16 years, 3 months
JBoss Native SVN: r1958 - trunk/mod_cluster/native/mod_manager.
by jbossnative-commits@lists.jboss.org
Author: jfrederic.clere(a)jboss.com
Date: 2008-10-16 04:15:45 -0400 (Thu, 16 Oct 2008)
New Revision: 1958
Modified:
trunk/mod_cluster/native/mod_manager/mod_manager.c
Log:
Adjust the default according https://www.jboss.org/community/docs/DOC-11427
Modified: trunk/mod_cluster/native/mod_manager/mod_manager.c
===================================================================
--- trunk/mod_cluster/native/mod_manager/mod_manager.c 2008-10-15 15:07:21 UTC (rev 1957)
+++ trunk/mod_cluster/native/mod_manager/mod_manager.c 2008-10-16 08:15:45 UTC (rev 1958)
@@ -536,6 +536,7 @@
memset(&balancerinfo, '\0', sizeof(balancerinfo));
strcpy(balancerinfo.balancer, "mycluster");
balancerinfo.StickySession = 1;
+ balancerinfo.StickySessionForce = 1;
strcpy(balancerinfo.StickySessionCookie, "JSESSIONID");
strcpy(balancerinfo.StickySessionPath, "jsessionid");
balancerinfo.Maxattempts = 1;
16 years, 3 months
JBoss Native SVN: r1957 - trunk/mod_cluster/test/java/org/jboss/mod_cluster.
by jbossnative-commits@lists.jboss.org
Author: jfrederic.clere(a)jboss.com
Date: 2008-10-15 11:07:21 -0400 (Wed, 15 Oct 2008)
New Revision: 1957
Modified:
trunk/mod_cluster/test/java/org/jboss/mod_cluster/NodeInfo.java
trunk/mod_cluster/test/java/org/jboss/mod_cluster/TestAddDel.java
Log:
Arrange code to use the new INFO syntax.
Modified: trunk/mod_cluster/test/java/org/jboss/mod_cluster/NodeInfo.java
===================================================================
--- trunk/mod_cluster/test/java/org/jboss/mod_cluster/NodeInfo.java 2008-10-14 11:20:57 UTC (rev 1956)
+++ trunk/mod_cluster/test/java/org/jboss/mod_cluster/NodeInfo.java 2008-10-15 15:07:21 UTC (rev 1957)
@@ -31,10 +31,8 @@
public class NodeInfo {
String JVMRoute;
- int status;
int lbfactor;
int elected;
- int removed;
/**
* Check that nodes in nodeinfos corresponds to nodes in nodenames
@@ -64,10 +62,8 @@
System.out.println("Name " + nodenames[i] + "found twice!!!");
return false; // twice.
}
- if (nodeinfos[j].removed == 0) {
- in[i] = true;
- hasit = true;
- }
+ in[i] = true;
+ hasit = true;
}
}
if (!hasit) {
@@ -75,12 +71,7 @@
return false; // not found.
}
}
- int i = 0;
- for (int j=0; j<nodeinfos.length; j++) {
- if (nodeinfos[j].removed == 0)
- i++;
- }
- if (i != nodenames.length) {
+ if (nodeinfos.length != nodenames.length) {
System.out.println("Too many route entries in httpd!!!");
return false; // Too many route entries in httpd.
}
@@ -98,7 +89,7 @@
for (int i=0; i<nodes.size(); i++) {
NodeInfo nodeinfo = (NodeInfo) nodes.get(i);
- System.out.println("Node[" + i + "]: " + nodeinfo.JVMRoute + " remove: " + nodeinfo.removed);
+ System.out.println("Node[" + i + "]: " + nodeinfo.JVMRoute);
}
for (int i=0; i<nodenames.length; i++) {
System.out.println("Name[" + i + "]: " + nodenames[i]);
Modified: trunk/mod_cluster/test/java/org/jboss/mod_cluster/TestAddDel.java
===================================================================
--- trunk/mod_cluster/test/java/org/jboss/mod_cluster/TestAddDel.java 2008-10-14 11:20:57 UTC (rev 1956)
+++ trunk/mod_cluster/test/java/org/jboss/mod_cluster/TestAddDel.java 2008-10-15 15:07:21 UTC (rev 1957)
@@ -102,25 +102,19 @@
// System.out.println("results[" + j + "]: " + results[j]);
String [] data = results[j].split(": ");
// System.out.println("data[" + 0 + "]: " + data[0] + "*");
- if ("node".equals(data[0]) && nodeinfo == null) {
+ if ("Node".equals(data[0]) && nodeinfo == null) {
nodeinfo = new NodeInfo();
continue;
}
- if ("JVMRoute".equals(data[0])) {
+ if ("Name".equals(data[0])) {
nodeinfo.JVMRoute = data[1];
}
- else if ("status".equals(data[0])) {
- nodeinfo.status = Integer.valueOf(data[1]).intValue();
- }
- else if ("lbfactor".equals(data[0])) {
+ else if ("Load".equals(data[0])) {
nodeinfo.lbfactor = Integer.valueOf(data[1]).intValue();
}
- else if ("elected".equals(data[0])) {
+ else if ("Elected".equals(data[0])) {
nodeinfo.elected = Integer.valueOf(data[1]).intValue();
}
- else if ("removed".equals(data[0])) {
- nodeinfo.removed = Integer.valueOf(data[1]).intValue();
- }
}
if (nodeinfo != null) {
// System.out.println("Adding: " + nodeinfo);
16 years, 3 months
JBoss Native SVN: r1956 - trunk/mod_cluster/native/mod_manager.
by jbossnative-commits@lists.jboss.org
Author: jfrederic.clere(a)jboss.com
Date: 2008-10-14 07:20:57 -0400 (Tue, 14 Oct 2008)
New Revision: 1956
Modified:
trunk/mod_cluster/native/mod_manager/mod_manager.c
Log:
Add balancer in the INFO.
Modified: trunk/mod_cluster/native/mod_manager/mod_manager.c
===================================================================
--- trunk/mod_cluster/native/mod_manager/mod_manager.c 2008-10-14 09:54:05 UTC (rev 1955)
+++ trunk/mod_cluster/native/mod_manager/mod_manager.c 2008-10-14 11:20:57 UTC (rev 1956)
@@ -795,8 +795,8 @@
proxy_worker_stat *proxystat;
char *flushpackets;
get_node(nodestatsmem, &ou, id[i]);
- ap_rprintf(r, "node: [%d],Name: %s,Domain: %s,Host: %s,Port: %s,Type: %s",
- id[i], ou->mess.JVMRoute, ou->mess.Domain,
+ ap_rprintf(r, "Node: [%d],Name: %s,Balancer: %s,Domain: %s,Host: %s,Port: %s,Type: %s",
+ id[i], ou->mess.JVMRoute, ou->mess.balancer, ou->mess.Domain,
ou->mess.Host, ou->mess.Port, ou->mess.Type);
flushpackets = "Off";
switch (ou->mess.flushpackets) {
16 years, 3 months
JBoss Native SVN: r1955 - trunk/mod_cluster/native/mod_manager.
by jbossnative-commits@lists.jboss.org
Author: jfrederic.clere(a)jboss.com
Date: 2008-10-14 05:54:05 -0400 (Tue, 14 Oct 2008)
New Revision: 1955
Modified:
trunk/mod_cluster/native/mod_manager/mod_manager.c
Log:
Arrange INFO to follow https://www.jboss.org/community/docs/DOC-11422
Modified: trunk/mod_cluster/native/mod_manager/mod_manager.c
===================================================================
--- trunk/mod_cluster/native/mod_manager/mod_manager.c 2008-10-13 13:01:38 UTC (rev 1954)
+++ trunk/mod_cluster/native/mod_manager/mod_manager.c 2008-10-14 09:54:05 UTC (rev 1955)
@@ -793,17 +793,65 @@
for (i=0; i<size; i++) {
nodeinfo_t *ou;
proxy_worker_stat *proxystat;
+ char *flushpackets;
get_node(nodestatsmem, &ou, id[i]);
- ap_rprintf(r, "node: [%d:%d],JVMRoute: %s,Domain: [%s],Host: %s,Port: %s,Type: %s",
- id[i], ou->mess.id, ou->mess.JVMRoute, ou->mess.Domain,
+ ap_rprintf(r, "node: [%d],Name: %s,Domain: %s,Host: %s,Port: %s,Type: %s",
+ id[i], ou->mess.JVMRoute, ou->mess.Domain,
ou->mess.Host, ou->mess.Port, ou->mess.Type);
+ flushpackets = "Off";
+ switch (ou->mess.flushpackets) {
+ case flush_on:
+ flushpackets = "On";
+ break;
+ case flush_auto:
+ flushpackets = "Auto";
+ }
+ ap_rprintf(r, ",Flushpackets: %s,Flushwait: %d,Ping: %d,Smax: %d,Ttl: %d",
+ flushpackets, ou->mess.flushwait,
+ ou->mess.ping, ou->mess.smax, ou->mess.ttl);
proxystat = (proxy_worker_stat *) ou->stat;
- ap_rprintf(r, ",removed: %d,status: %d,elected: %d,lbstatus: %d,lbfactor: %d,route: %s\n",
- ou->mess.remove,
- proxystat->status, proxystat->elected, proxystat->lbstatus,
- proxystat->lbfactor, proxystat->route);
+ ap_rprintf(r, ",Elected: %d,Read: %d,Transfered: %d,Connected: %d,Load: %d\n",
+ proxystat->elected, proxystat->read, proxystat->transferred,
+ proxystat->busy, proxystat->lbfactor);
}
+
+ /* Process the Vhosts */
+ size = get_max_size_host(hoststatsmem);
+ id = apr_palloc(r->pool, sizeof(int) * size);
+ size = get_ids_used_host(hoststatsmem, id);
+ for (i=0; i<size; i++) {
+ hostinfo_t *ou;
+ get_host(hoststatsmem, &ou, id[i]);
+ ap_rprintf(r, "Vhost: [%d:%d:%d], Alias: %s\n",
+ ou->node, ou->vhost, id[i], ou->host);
+ }
+
+ /* Process the Contexts */
+ size = get_max_size_context(contextstatsmem);
+ id = apr_palloc(r->pool, sizeof(int) * size);
+ size = get_ids_used_context(contextstatsmem, id);
+ for (i=0; i<size; i++) {
+ contextinfo_t *ou;
+ char *status;
+ get_context(contextstatsmem, &ou, id[i]);
+ status = "REMOVED";
+ switch (ou->status) {
+ case ENABLED:
+ status = "ENABLED";
+ break;
+ case DISABLED:
+ status = "DISABLED";
+ break;
+ case STOPPED:
+ status = "STOPPED";
+ break;
+ }
+ ap_rprintf(r, "Context: [%d:%d:%d], Context: %s, Status: %s\n",
+ ou->node, ou->vhost, id[i],
+ ou->context,
+ status);
+ }
return NULL;
}
16 years, 3 months