JBoss Native SVN: r2407 - trunk/mod_cluster/src/main/java/org/jboss/modcluster/advertise/impl.
by jbossnative-commits@lists.jboss.org
Author: jfrederic.clere(a)jboss.com
Date: 2009-04-27 09:43:28 -0400 (Mon, 27 Apr 2009)
New Revision: 2407
Modified:
trunk/mod_cluster/src/main/java/org/jboss/modcluster/advertise/impl/AdvertiseListenerImpl.java
Log:
After Paul patches for MODCLUSTER-73. The hudson builds are hanging
on no-linux box. This fix it and prevent the exception of MODCLUSTER-73.
Modified: trunk/mod_cluster/src/main/java/org/jboss/modcluster/advertise/impl/AdvertiseListenerImpl.java
===================================================================
--- trunk/mod_cluster/src/main/java/org/jboss/modcluster/advertise/impl/AdvertiseListenerImpl.java 2009-04-27 13:34:03 UTC (rev 2406)
+++ trunk/mod_cluster/src/main/java/org/jboss/modcluster/advertise/impl/AdvertiseListenerImpl.java 2009-04-27 13:43:28 UTC (rev 2407)
@@ -316,7 +316,7 @@
try
{
// Wait for worker to complete
- this.workerThread.join();
+ this.workerThread.join(1000);
}
catch (InterruptedException e)
{
@@ -429,6 +429,8 @@
this.wait();
}
}
+ if (AdvertiseListenerImpl.this.socket == null)
+ break;
DatagramPacket packet = new DatagramPacket(buffer, buffer.length);
15 years, 8 months
JBoss Native SVN: r2406 - trunk/mod_cluster/src/test/java/org/jboss/modcluster/mcmp.
by jbossnative-commits@lists.jboss.org
Author: pferraro
Date: 2009-04-27 09:34:03 -0400 (Mon, 27 Apr 2009)
New Revision: 2406
Modified:
trunk/mod_cluster/src/test/java/org/jboss/modcluster/mcmp/DefaultMCMPRequestFactoryTestCase.java
Log:
Fixed reordering of elements of HashSet in testCreateRequest()
Modified: trunk/mod_cluster/src/test/java/org/jboss/modcluster/mcmp/DefaultMCMPRequestFactoryTestCase.java
===================================================================
--- trunk/mod_cluster/src/test/java/org/jboss/modcluster/mcmp/DefaultMCMPRequestFactoryTestCase.java 2009-04-23 18:56:25 UTC (rev 2405)
+++ trunk/mod_cluster/src/test/java/org/jboss/modcluster/mcmp/DefaultMCMPRequestFactoryTestCase.java 2009-04-27 13:34:03 UTC (rev 2406)
@@ -22,7 +22,7 @@
package org.jboss.modcluster.mcmp;
import java.util.Arrays;
-import java.util.HashSet;
+import java.util.LinkedHashSet;
import java.util.Map;
import org.apache.catalina.Context;
@@ -334,7 +334,7 @@
@Test
public void testCreateRequest()
{
- MCMPRequest request = this.factory.createRequest(MCMPRequestType.REMOVE_APP, "route", new HashSet<String>(Arrays.asList("alias1", "alias2")), "path");
+ MCMPRequest request = this.factory.createRequest(MCMPRequestType.REMOVE_APP, "route", new LinkedHashSet<String>(Arrays.asList("alias1", "alias2")), "path");
Assert.assertSame(MCMPRequestType.REMOVE_APP, request.getRequestType());
Assert.assertFalse(request.isWildcard());
15 years, 8 months
JBoss Native SVN: r2405 - trunk/mod_cluster/src/main/java/org/jboss/modcluster/advertise/impl.
by jbossnative-commits@lists.jboss.org
Author: pferraro
Date: 2009-04-23 14:56:25 -0400 (Thu, 23 Apr 2009)
New Revision: 2405
Modified:
trunk/mod_cluster/src/main/java/org/jboss/modcluster/advertise/impl/AdvertiseListenerImpl.java
Log:
[MODCLUSTER-73] Wait for worker to die in stop() to prevent NullPointerException if worker tries to use socket after destroy()
Modified: trunk/mod_cluster/src/main/java/org/jboss/modcluster/advertise/impl/AdvertiseListenerImpl.java
===================================================================
--- trunk/mod_cluster/src/main/java/org/jboss/modcluster/advertise/impl/AdvertiseListenerImpl.java 2009-04-23 10:07:06 UTC (rev 2404)
+++ trunk/mod_cluster/src/main/java/org/jboss/modcluster/advertise/impl/AdvertiseListenerImpl.java 2009-04-23 18:56:25 UTC (rev 2405)
@@ -71,7 +71,7 @@
InetAddress groupAddress = null;
private MulticastSocketFactory socketFactory;
- MulticastSocket socket;
+ volatile MulticastSocket socket;
private boolean daemon = true;
@@ -309,7 +309,20 @@
if (this.workerThread != null)
{
this.workerThread.interrupt();
+
+ // In case worker is stuck on socket.receive(...)
this.interruptDatagramReader();
+
+ try
+ {
+ // Wait for worker to complete
+ this.workerThread.join();
+ }
+ catch (InterruptedException e)
+ {
+ Thread.currentThread().interrupt();
+ }
+
this.workerThread = null;
this.listening = false;
15 years, 8 months
JBoss Native SVN: r2404 - trunk/mod_cluster/native/mod_manager.
by jbossnative-commits@lists.jboss.org
Author: jfrederic.clere(a)jboss.com
Date: 2009-04-23 06:07:06 -0400 (Thu, 23 Apr 2009)
New Revision: 2404
Modified:
trunk/mod_cluster/native/mod_manager/mod_manager.c
Log:
Finish fixing MODCLUSTER-69 (allow to disable/enable all contexts on a node).
Modified: trunk/mod_cluster/native/mod_manager/mod_manager.c
===================================================================
--- trunk/mod_cluster/native/mod_manager/mod_manager.c 2009-04-23 09:09:15 UTC (rev 2403)
+++ trunk/mod_cluster/native/mod_manager/mod_manager.c 2009-04-23 10:07:06 UTC (rev 2404)
@@ -1368,7 +1368,7 @@
/* Create the commands that are possible on the context */
static char*context_string(request_rec *r, contextinfo_t *ou, char *Alias, char *JVMRoute)
{
- char *raw = apr_pstrcat(r->pool, "JVMRoute=", JVMRoute, "&Alias=", Alias, "&Context=", ou->context);
+ char *raw = apr_pstrcat(r->pool, "JVMRoute=", JVMRoute, "&Alias=", Alias, "&Context=", ou->context, NULL);
return raw;
}
static void context_command_string(request_rec *r, contextinfo_t *ou, char *Alias, char *JVMRoute)
@@ -1380,6 +1380,21 @@
ap_rprintf(r, "<a href=\"%s?nonce=%s&Cmd=DISABLE-APP&Range=CONTEXT&%s\">Disable</a>",
r->uri, balancer_nonce, context_string(r, ou, Alias, JVMRoute));
}
+/* Create the commands that are possible on the node */
+static char*node_string(request_rec *r, char *JVMRoute)
+{
+ char *raw = apr_pstrcat(r->pool, "JVMRoute=", JVMRoute, NULL);
+ return raw;
+}
+static void node_command_string(request_rec *r, int status, char *JVMRoute)
+{
+ if (status == ENABLED)
+ ap_rprintf(r, "<a href=\"%s?nonce=%s&Cmd=ENABLE-APP&Range=NODE&%s\">Enable Contexts</a> ",
+ r->uri, balancer_nonce, node_string(r, JVMRoute));
+ if (status == DISABLED)
+ ap_rprintf(r, "<a href=\"%s?nonce=%s&Cmd=DISABLE-APP&Range=NODE&%s\">Disable Contexts</a>",
+ r->uri, balancer_nonce, node_string(r, JVMRoute));
+}
/*
* Process the parameters and display corresponding informations.
@@ -1616,9 +1631,13 @@
char *flushpackets;
if (get_node(nodestatsmem, &ou, id[i]) != APR_SUCCESS)
continue;
- ap_rprintf(r, "<h1> Node %s (%s://%s:%s):</h1>\n",
+ ap_rprintf(r, "<h1> Node %s (%s://%s:%s): ",
ou->mess.JVMRoute, ou->mess.Type, ou->mess.Host, ou->mess.Port);
+ node_command_string(r, ENABLED, ou->mess.JVMRoute);
+ node_command_string(r, DISABLED, ou->mess.JVMRoute);
+ ap_rprintf(r, "</h1>\n");
+
ap_rprintf(r, "Balancer: %s,Domain: %s", ou->mess.balancer, ou->mess.Domain);
flushpackets = "Off";
15 years, 8 months
JBoss Native SVN: r2403 - trunk/mod_cluster/native/mod_manager.
by jbossnative-commits@lists.jboss.org
Author: jfrederic.clere(a)jboss.com
Date: 2009-04-23 05:09:15 -0400 (Thu, 23 Apr 2009)
New Revision: 2403
Modified:
trunk/mod_cluster/native/mod_manager/mod_manager.c
Log:
Simplify the disable/enable individual apps logic.
Modified: trunk/mod_cluster/native/mod_manager/mod_manager.c
===================================================================
--- trunk/mod_cluster/native/mod_manager/mod_manager.c 2009-04-23 07:36:35 UTC (rev 2402)
+++ trunk/mod_cluster/native/mod_manager/mod_manager.c 2009-04-23 09:09:15 UTC (rev 2403)
@@ -585,7 +585,7 @@
* Context corresponding to the applications.
* Context: <context list>
*/
-static char * process_config(request_rec *r, char *buff, int *errtype)
+static char * process_config(request_rec *r, char **ptr, int *errtype)
{
/* Process the node/balancer description */
nodeinfo_t nodeinfo;
@@ -600,11 +600,6 @@
int id;
int vid = 1; /* zero and "" is empty */
- char **ptr = process_buff(r, buff);
- if (ptr == NULL) {
- *errtype = TYPESYNTAX;
- return SMESPAR;
- }
vhost = apr_palloc(r->pool, sizeof(struct cluster_host));
/* Map nothing by default */
@@ -824,7 +819,7 @@
/*
* Process a DUMP command.
*/
-static char * process_dump(request_rec *r, char *buff, int *errtype)
+static char * process_dump(request_rec *r, char **ptr, int *errtype)
{
int size, i;
int *id;
@@ -887,7 +882,7 @@
* Process a INFO command.
* Statics informations ;-)
*/
-static char * process_info(request_rec *r, char *buff, int *errtype)
+static char * process_info(request_rec *r, char **ptr, int *errtype)
{
int size, i;
int *id;
@@ -1020,7 +1015,7 @@
}
/* Process an enable/disable/stop/remove application message */
-static char * process_appl_cmd(request_rec *r, char *buff, int status, int *errtype, int global)
+static char * process_appl_cmd(request_rec *r, char **ptr, int status, int *errtype, int global)
{
nodeinfo_t nodeinfo;
nodeinfo_t *node;
@@ -1030,13 +1025,6 @@
hostinfo_t hostinfo;
hostinfo_t *host;
-
- char **ptr = process_buff(r, buff);
- if (ptr == NULL) {
- *errtype = TYPESYNTAX;
- return SMESPAR;
- }
-
memset(&nodeinfo.mess, '\0', sizeof(nodeinfo.mess));
/* Map nothing by default */
vhost = apr_palloc(r->pool, sizeof(struct cluster_host));
@@ -1153,21 +1141,21 @@
}
return NULL;
}
-static char * process_enable(request_rec *r, char *buff, int *errtype, int global)
+static char * process_enable(request_rec *r, char **ptr, int *errtype, int global)
{
- return process_appl_cmd(r, buff, ENABLED, errtype, global);
+ return process_appl_cmd(r, ptr, ENABLED, errtype, global);
}
-static char * process_disable(request_rec *r, char *buff, int *errtype, int global)
+static char * process_disable(request_rec *r, char **ptr, int *errtype, int global)
{
- return process_appl_cmd(r, buff, DISABLED, errtype, global);
+ return process_appl_cmd(r, ptr, DISABLED, errtype, global);
}
-static char * process_stop(request_rec *r, char *buff, int *errtype, int global)
+static char * process_stop(request_rec *r, char **ptr, int *errtype, int global)
{
- return process_appl_cmd(r, buff, STOPPED, errtype, global);
+ return process_appl_cmd(r, ptr, STOPPED, errtype, global);
}
-static char * process_remove(request_rec *r, char *buff, int *errtype, int global)
+static char * process_remove(request_rec *r, char **ptr, int *errtype, int global)
{
- return process_appl_cmd(r, buff, REMOVE, errtype, global);
+ return process_appl_cmd(r, ptr, REMOVE, errtype, global);
}
/*
@@ -1187,7 +1175,7 @@
* Load 0 : Standby.
* Load 1-100 : Load factor.
*/
-static char * process_status(request_rec *r, char *buff, int *errtype)
+static char * process_status(request_rec *r, char **ptr, int *errtype)
{
int Load = -1;
nodeinfo_t nodeinfo;
@@ -1195,12 +1183,6 @@
int i = 0;
- char **ptr = process_buff(r, buff);
- if (ptr == NULL) {
- *errtype = TYPESYNTAX;
- return SMESPAR;
- }
-
while (ptr[i]) {
if (strcasecmp(ptr[i], "JVMRoute") == 0) {
if (strlen(ptr[i+1])>=sizeof(nodeinfo.mess.JVMRoute)) {
@@ -1386,16 +1368,16 @@
/* Create the commands that are possible on the context */
static char*context_string(request_rec *r, contextinfo_t *ou, char *Alias, char *JVMRoute)
{
- char *raw = apr_pstrcat(r->pool, "JVMRoute%3d", JVMRoute, "%26Alias%3d", Alias, "%26Context%3d", ou->context);
+ char *raw = apr_pstrcat(r->pool, "JVMRoute=", JVMRoute, "&Alias=", Alias, "&Context=", ou->context);
return raw;
}
static void context_command_string(request_rec *r, contextinfo_t *ou, char *Alias, char *JVMRoute)
{
if (ou->status == DISABLED)
- ap_rprintf(r, "<a href=\"%s?nonce=%s&Cmd=ENABLE-APP&Range=CONTEXT&String=%s\">Enable</a> ",
+ ap_rprintf(r, "<a href=\"%s?nonce=%s&Cmd=ENABLE-APP&Range=CONTEXT&%s\">Enable</a> ",
r->uri, balancer_nonce, context_string(r, ou, Alias, JVMRoute));
if (ou->status == ENABLED)
- ap_rprintf(r, "<a href=\"%s?nonce=%s&Cmd=DISABLE-APP&Range=CONTEXT&String=%s\">Disable</a>",
+ ap_rprintf(r, "<a href=\"%s?nonce=%s&Cmd=DISABLE-APP&Range=CONTEXT&%s\">Disable</a>",
r->uri, balancer_nonce, context_string(r, ou, Alias, JVMRoute));
}
@@ -1545,7 +1527,7 @@
* Special case: contexts contain path information
*/
if ((access_status = ap_unescape_url(val)) != OK)
- if (strcmp(args, "String") || (access_status != HTTP_NOT_FOUND))
+ if (strcmp(args, "Context") || (access_status != HTTP_NOT_FOUND))
return access_status;
apr_table_setn(params, args, val);
args = tok;
@@ -1569,28 +1551,39 @@
const char *val = apr_table_get(params, "Refresh");
const char *cmd = apr_table_get(params, "Cmd");
const char *typ = apr_table_get(params, "Range");
- const char *string = apr_table_get(params, "String");
/* Process the Refresh parameter */
if (val) {
long t = atol(val);
apr_table_set(r->headers_out, "Refresh", apr_ltoa(r->pool,t < 1 ? 10 : t));
}
/* Process command if any */
- if (cmd != NULL && typ !=NULL && string != NULL) {
+ if (cmd != NULL && typ !=NULL) {
int global = 0;
char *errstring = NULL;
int errtype = 0;
- char *buff = apr_pstrdup(r->pool, string);
+ int i;
+ char **ptr;
+ const apr_array_header_t *arr = apr_table_elts(params);
+ const apr_table_entry_t *elts = (const apr_table_entry_t *)arr->elts;
+
+ ptr = apr_palloc(r->pool, sizeof(char *) * (arr->nelts + 1) * 2);
+ for (i = 0; i < arr->nelts; i++) {
+ ptr[i*2] = elts[i].key;
+ ptr[i*2+1] = elts[i].val;
+ }
+ ptr[arr->nelts*2] = NULL;
+ ptr[arr->nelts*2+1] = NULL;
+
if (strcasecmp(typ,"NODE")==0)
global = 1;
if (strcasecmp(cmd, "ENABLE-APP") == 0)
- errstring = process_enable(r, buff, &errtype, global);
+ errstring = process_enable(r, ptr, &errtype, global);
else if (strcasecmp(cmd, "DISABLE-APP") == 0)
- errstring = process_disable(r, buff, &errtype, global);
+ errstring = process_disable(r, ptr, &errtype, global);
else if (strcasecmp(cmd, "STOP-APP") == 0)
- errstring = process_stop(r, buff, &errtype, global);
+ errstring = process_stop(r, ptr, &errtype, global);
else if (strcasecmp(cmd, "REMOVE-APP") == 0)
- errstring = process_remove(r, buff, &errtype, global);
+ errstring = process_remove(r, ptr, &errtype, global);
else {
errstring = SCMDUNS;
errtype = TYPESYNTAX;
@@ -1670,6 +1663,7 @@
apr_size_t bufsiz=MAXMESSSIZE;
apr_status_t status;
int global = 0;
+ char **ptr;
if (strcmp(r->handler, "mod_cluster-manager") == 0) {
/* Display the nodes information */
@@ -1701,27 +1695,34 @@
/* XXX: Size limit it? */
ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, r->server,
"manager_handler %s (%s) processing: \"%s\"", r->method, r->filename, buff);
+
decodeenc(buff);
+ ptr = process_buff(r, buff);
+ if (ptr == NULL) {
+ process_error(r, SMESPAR, TYPESYNTAX);
+ return 500;
+ }
if (strstr(r->filename, NODE_COMMAND))
global = 1;
+
if (strcasecmp(r->method, "CONFIG") == 0)
- errstring = process_config(r, buff, &errtype);
+ errstring = process_config(r, ptr, &errtype);
/* Application handling */
else if (strcasecmp(r->method, "ENABLE-APP") == 0)
- errstring = process_enable(r, buff, &errtype, global);
+ errstring = process_enable(r, ptr, &errtype, global);
else if (strcasecmp(r->method, "DISABLE-APP") == 0)
- errstring = process_disable(r, buff, &errtype, global);
+ errstring = process_disable(r, ptr, &errtype, global);
else if (strcasecmp(r->method, "STOP-APP") == 0)
- errstring = process_stop(r, buff, &errtype, global);
+ errstring = process_stop(r, ptr, &errtype, global);
else if (strcasecmp(r->method, "REMOVE-APP") == 0)
- errstring = process_remove(r, buff, &errtype, global);
+ errstring = process_remove(r, ptr, &errtype, global);
/* Status handling */
else if (strcasecmp(r->method, "STATUS") == 0)
- errstring = process_status(r, buff, &errtype);
+ errstring = process_status(r, ptr, &errtype);
else if (strcasecmp(r->method, "DUMP") == 0)
- errstring = process_dump(r, buff, &errtype);
+ errstring = process_dump(r, ptr, &errtype);
else if (strcasecmp(r->method, "INFO") == 0)
- errstring = process_info(r, buff, &errtype);
+ errstring = process_info(r, ptr, &errtype);
else {
errstring = SCMDUNS;
errtype = TYPESYNTAX;
15 years, 8 months
JBoss Native SVN: r2402 - trunk/build/unix.
by jbossnative-commits@lists.jboss.org
Author: jfrederic.clere(a)jboss.com
Date: 2009-04-23 03:36:35 -0400 (Thu, 23 Apr 2009)
New Revision: 2402
Modified:
trunk/build/unix/build.sh
Log:
Test for posix_tar instead set it according to the platform.
Modified: trunk/build/unix/build.sh
===================================================================
--- trunk/build/unix/build.sh 2009-04-22 18:25:12 UTC (rev 2401)
+++ trunk/build/unix/build.sh 2009-04-23 07:36:35 UTC (rev 2402)
@@ -330,7 +330,6 @@
;;
HP-UX*)
BUILD_SYS="hpux"
- has_posix_tar=false
CC=cc
export CC
# http://hpux.cs.utah.edu/ only has a 32 bits one.
@@ -359,6 +358,16 @@
;;
esac
+# Check for a posix tar
+mkdir test.$$
+tar --owner=root --group=bin -cf /dev/null test.$$
+if [ $? -ne 0 ]; then
+ has_posix_tar=false
+fi
+rm -rf test.$$
+echo "has_posix_tar: ${has_posix_tar}"
+
+
# Display what we are going to do.
echo "Building ${PACKAGE} on ${BUILD_SYS} ${BUILD_CPU}"
if $has_apr; then
15 years, 8 months
JBoss Native SVN: r2401 - trunk/mod_cluster.
by jbossnative-commits@lists.jboss.org
Author: pferraro
Date: 2009-04-22 14:25:12 -0400 (Wed, 22 Apr 2009)
New Revision: 2401
Modified:
trunk/mod_cluster/pom.xml
Log:
Add missing groupId to release plugin
Modified: trunk/mod_cluster/pom.xml
===================================================================
--- trunk/mod_cluster/pom.xml 2009-04-22 18:22:05 UTC (rev 2400)
+++ trunk/mod_cluster/pom.xml 2009-04-22 18:25:12 UTC (rev 2401)
@@ -67,6 +67,7 @@
</executions>
</plugin>
<plugin>
+ <groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<configuration>
<tagBase>https://svn.jboss.org/repos/jbossnative/tags/mod_cluster</tagBase>
15 years, 8 months
JBoss Native SVN: r2400 - in trunk/mod_cluster/src: main/java/org/jboss/modcluster/ha and 2 other directories.
by jbossnative-commits@lists.jboss.org
Author: pferraro
Date: 2009-04-22 14:22:05 -0400 (Wed, 22 Apr 2009)
New Revision: 2400
Modified:
trunk/mod_cluster/src/main/java/org/jboss/modcluster/AbstractModClusterService.java
trunk/mod_cluster/src/main/java/org/jboss/modcluster/LocalStrings.properties
trunk/mod_cluster/src/main/java/org/jboss/modcluster/ModClusterServiceMBean.java
trunk/mod_cluster/src/main/java/org/jboss/modcluster/Utils.java
trunk/mod_cluster/src/main/java/org/jboss/modcluster/ha/HAModClusterService.java
trunk/mod_cluster/src/main/java/org/jboss/modcluster/mbeans-descriptors.xml
trunk/mod_cluster/src/test/java/org/jboss/modcluster/ModClusterServiceTestCase.java
trunk/mod_cluster/src/test/java/org/jboss/modcluster/ha/HAModClusterServiceTestCase.java
Log:
[MODCLUSTER-68] Add ability to disable/enable individual webapp via JMX
Modified: trunk/mod_cluster/src/main/java/org/jboss/modcluster/AbstractModClusterService.java
===================================================================
--- trunk/mod_cluster/src/main/java/org/jboss/modcluster/AbstractModClusterService.java 2009-04-22 11:23:17 UTC (rev 2399)
+++ trunk/mod_cluster/src/main/java/org/jboss/modcluster/AbstractModClusterService.java 2009-04-22 18:22:05 UTC (rev 2400)
@@ -178,4 +178,34 @@
return this.mcmpHandler.isProxyHealthOK();
}
+
+ /**
+ * @{inheritDoc}
+ * @see org.jboss.modcluster.ModClusterServiceMBean#disable(java.lang.String, java.lang.String)
+ */
+ public boolean disable(String host, String path)
+ {
+ Context context = Utils.getContext(Utils.getHost(this.serverProvider.getServer(), host), path);
+
+ // Send DISABLE-APP /... request
+ MCMPRequest request = this.requestFactory.createDisableRequest(context);
+ this.mcmpHandler.sendRequest(request);
+
+ return this.mcmpHandler.isProxyHealthOK();
+ }
+
+ /**
+ * @{inheritDoc}
+ * @see org.jboss.modcluster.ModClusterServiceMBean#enable(java.lang.String, java.lang.String)
+ */
+ public boolean enable(String host, String path)
+ {
+ Context context = Utils.getContext(Utils.getHost(this.serverProvider.getServer(), host), path);
+
+ // Send ENABLE-APP /... request
+ MCMPRequest request = this.requestFactory.createEnableRequest(context);
+ this.mcmpHandler.sendRequest(request);
+
+ return this.mcmpHandler.isProxyHealthOK();
+ }
}
\ No newline at end of file
Modified: trunk/mod_cluster/src/main/java/org/jboss/modcluster/LocalStrings.properties
===================================================================
--- trunk/mod_cluster/src/main/java/org/jboss/modcluster/LocalStrings.properties 2009-04-22 11:23:17 UTC (rev 2399)
+++ trunk/mod_cluster/src/main/java/org/jboss/modcluster/LocalStrings.properties 2009-04-22 18:22:05 UTC (rev 2400)
@@ -1,8 +1,8 @@
# Regular messages
-modcluster.context.disable=Undeploy context [{0}] to Host [{1}]
-modcluster.context.enable=Deploy context [{0}] to Host [{1}]
-modcluster.context.start=Start context [{0}] in Host [{1}]
-modcluster.context.stop=Stop context [{0}] in Host [{1}]
+modcluster.context.disable=Undeploy context [{0}] to host [{1}]
+modcluster.context.enable=Deploy context [{0}] to host [{1}]
+modcluster.context.start=Start context [{0}] in host [{1}]
+modcluster.context.stop=Stop context [{0}] in host [{1}]
modcluster.engine.config=Sending configuration for engine [{0}]
modcluster.engine.status=Check status for engine [{0}]
modcluster.engine.stop=Stop all web applications for engine [{0}]
@@ -13,10 +13,12 @@
# Error messages
modcluster.error.addressJvmRoute=Error connecting to proxy to determine Engine.JVMRoute or Connector.address
+modcluster.error.context.notfound=Host [{0}] does not contain a context with path [{1}]
modcluster.error.discovery.add=Failure notifying master of added proxy [{0}]:[{1}]
modcluster.error.discovery.remove=Failure notifying master of removed proxy [{0}]:[{1}]
modcluster.error.drm="Error updating DRM
-modcluster.error.invalidHost=Invalid host specified: {0}
+modcluster.error.host.invalid=[{0}] is not a valid host
+modcluster.error.host.notfound=Server does not contain host [{0}]
modcluster.error.io=IO error sending command {0} to proxy {1}
modcluster.error.jmxRegister=Error during JMX registration
modcluster.error.jmxUnregister=Error during JMX unregistration
Modified: trunk/mod_cluster/src/main/java/org/jboss/modcluster/ModClusterServiceMBean.java
===================================================================
--- trunk/mod_cluster/src/main/java/org/jboss/modcluster/ModClusterServiceMBean.java 2009-04-22 11:23:17 UTC (rev 2399)
+++ trunk/mod_cluster/src/main/java/org/jboss/modcluster/ModClusterServiceMBean.java 2009-04-22 18:22:05 UTC (rev 2400)
@@ -49,7 +49,7 @@
void removeProxy(String host, int port);
/**
- * Retrieves the full proxy configuration. To be used through JMX or similar.
+ * Retrieves the full proxy configuration.
*
* response: HTTP/1.1 200 OK
* response:
@@ -75,22 +75,36 @@
/**
* Reset a DOWN connection to the proxy up to ERROR, where the configuration will
- * be refreshed. To be used through JMX or similar.
+ * be refreshed.
*/
public void reset();
/**
- * Refresh configuration. To be used through JMX or similar.
+ * Refresh configuration.
*/
public void refresh();
/**
- * Disable all webapps for all engines. To be used through JMX or similar.
+ * Disable all webapps for all engines.
*/
public boolean disable();
/**
- * Enable all webapps for all engines. To be used through JMX or similar.
+ * Enable all webapps for all engines.
*/
public boolean enable();
+
+ /**
+ * Disables the webapp with the specified host and context path.
+ * @param hostName host name of the target webapp
+ * @param contextPath context path of the target webapp
+ */
+ public boolean disable(String hostName, String contextPath);
+
+ /**
+ * Enables the webapp with the specified host and context path.
+ * @param hostName host name of the target webapp
+ * @param contextPath context path of the target webapp
+ */
+ public boolean enable(String hostName, String contextPath);
}
Modified: trunk/mod_cluster/src/main/java/org/jboss/modcluster/Utils.java
===================================================================
--- trunk/mod_cluster/src/main/java/org/jboss/modcluster/Utils.java 2009-04-22 11:23:17 UTC (rev 2399)
+++ trunk/mod_cluster/src/main/java/org/jboss/modcluster/Utils.java 2009-04-22 18:22:05 UTC (rev 2400)
@@ -15,9 +15,12 @@
import java.util.Map;
import java.util.Set;
+import org.apache.catalina.Container;
import org.apache.catalina.Context;
import org.apache.catalina.Engine;
import org.apache.catalina.Host;
+import org.apache.catalina.Server;
+import org.apache.catalina.Service;
import org.apache.catalina.connector.Connector;
import org.apache.catalina.util.StringManager;
import org.apache.coyote.ProtocolHandler;
@@ -273,7 +276,7 @@
}
catch (UnknownHostException e)
{
- log.error(sm.getString("modcluster.error.invalidHost", token), e);
+ log.error(sm.getString("modcluster.error.host.invalid", token), e);
}
}
@@ -338,6 +341,47 @@
return map;
}
+ public static Host findHost(Server server, String hostName)
+ {
+ String name = (hostName != null) ? hostName : DEFAULT_HOST;
+
+ for (Service service: server.findServices())
+ {
+ Container host = service.getContainer().findChild(name);
+
+ if (host != null)
+ {
+ return (Host) host;
+ }
+ }
+
+ return null;
+ }
+
+ public static Host getHost(Server server, String hostName)
+ {
+ Host host = findHost(server, hostName);
+
+ if (host == null)
+ {
+ throw new IllegalArgumentException(sm.getString("modcluster.error.host.notfound", hostName));
+ }
+
+ return host;
+ }
+
+ public static Context getContext(Host host, String path)
+ {
+ Container context = host.findChild(path);
+
+ if (context == null)
+ {
+ throw new IllegalArgumentException(sm.getString("modcluster.error.context.notfound", host.getName(), path));
+ }
+
+ return (Context) context;
+ }
+
private Utils()
{
}
Modified: trunk/mod_cluster/src/main/java/org/jboss/modcluster/ha/HAModClusterService.java
===================================================================
--- trunk/mod_cluster/src/main/java/org/jboss/modcluster/ha/HAModClusterService.java 2009-04-22 11:23:17 UTC (rev 2399)
+++ trunk/mod_cluster/src/main/java/org/jboss/modcluster/ha/HAModClusterService.java 2009-04-22 18:22:05 UTC (rev 2400)
@@ -342,6 +342,36 @@
return this.clusteredHandler.isProxyHealthOK();
}
+
+ /**
+ * @{inheritDoc}
+ * @see org.jboss.modcluster.ModClusterServiceMBean#disable(java.lang.String, java.lang.String)
+ */
+ public boolean disable(String host, String path)
+ {
+ Context context = Utils.getContext(Utils.getHost(this.serverProvider.getServer(), host), path);
+
+ // Send DISABLE-APP /... request
+ MCMPRequest request = this.requestFactory.createDisableRequest(context);
+ this.clusteredHandler.sendRequest(request);
+
+ return this.clusteredHandler.isProxyHealthOK();
+ }
+
+ /**
+ * @{inheritDoc}
+ * @see org.jboss.modcluster.ModClusterServiceMBean#enable(java.lang.String, java.lang.String)
+ */
+ public boolean enable(String host, String path)
+ {
+ Context context = Utils.getContext(Utils.getHost(this.serverProvider.getServer(), host), path);
+
+ // Send ENABLE-APP /... request
+ MCMPRequest request = this.requestFactory.createEnableRequest(context);
+ this.clusteredHandler.sendRequest(request);
+
+ return this.clusteredHandler.isProxyHealthOK();
+ }
// ------------------------------------------------------------- Properties
Modified: trunk/mod_cluster/src/main/java/org/jboss/modcluster/mbeans-descriptors.xml
===================================================================
--- trunk/mod_cluster/src/main/java/org/jboss/modcluster/mbeans-descriptors.xml 2009-04-22 11:23:17 UTC (rev 2399)
+++ trunk/mod_cluster/src/main/java/org/jboss/modcluster/mbeans-descriptors.xml 2009-04-22 18:22:05 UTC (rev 2400)
@@ -105,6 +105,30 @@
returnType="boolean"/>
<operation name="enable"
+ description="Enable a single webapp"
+ impact="ACTION"
+ returnType="boolean">
+ <parameter name="hostName"
+ description="Host name of the target webapp"
+ type="java.lang.String"/>
+ <parameter name="contextPath"
+ description="Context path of the webapp"
+ type="java.lang.String"/>
+ </operation>
+
+ <operation name="disable"
+ description="Disable a single webapp"
+ impact="ACTION"
+ returnType="boolean">
+ <parameter name="hostName"
+ description="Host name of the target webapp"
+ type="java.lang.String"/>
+ <parameter name="contextPath"
+ description="Context path of the webapp"
+ type="java.lang.String"/>
+ </operation>
+
+ <operation name="enable"
description="Enable all webapps for all engines"
impact="ACTION"
returnType="boolean"/>
Modified: trunk/mod_cluster/src/test/java/org/jboss/modcluster/ModClusterServiceTestCase.java
===================================================================
--- trunk/mod_cluster/src/test/java/org/jboss/modcluster/ModClusterServiceTestCase.java 2009-04-22 11:23:17 UTC (rev 2399)
+++ trunk/mod_cluster/src/test/java/org/jboss/modcluster/ModClusterServiceTestCase.java 2009-04-22 18:22:05 UTC (rev 2400)
@@ -21,7 +21,9 @@
*/
package org.jboss.modcluster;
+import org.apache.catalina.Context;
import org.apache.catalina.Engine;
+import org.apache.catalina.Host;
import org.apache.catalina.Lifecycle;
import org.apache.catalina.LifecycleEvent;
import org.apache.catalina.LifecycleListener;
@@ -212,4 +214,74 @@
Assert.assertTrue(result);
}
+
+ @SuppressWarnings("boxing")
+ @Test
+ public void enableContext()
+ {
+ String hostName = "host1";
+ String path = "/";
+
+ Server server = EasyMock.createStrictMock(Server.class);
+ Service service = EasyMock.createStrictMock(Service.class);
+ Engine engine = EasyMock.createStrictMock(Engine.class);
+ Host host = EasyMock.createStrictMock(Host.class);
+ Context context = EasyMock.createStrictMock(Context.class);
+ MCMPRequest request = EasyMock.createMock(MCMPRequest.class);
+
+ EasyMock.expect(this.serverProvider.getServer()).andReturn(server);
+ EasyMock.expect(server.findServices()).andReturn(new Service[] { service });
+ EasyMock.expect(service.getContainer()).andReturn(engine);
+ EasyMock.expect(engine.findChild(hostName)).andReturn(host);
+ EasyMock.expect(host.findChild(path)).andReturn(context);
+
+ EasyMock.expect(this.requestFactory.createEnableRequest(context)).andReturn(request);
+
+ EasyMock.expect(this.mcmpHandler.sendRequest(request)).andReturn(null);
+
+ EasyMock.expect(this.mcmpHandler.isProxyHealthOK()).andReturn(true);
+
+ EasyMock.replay(this.serverProvider, this.requestFactory, this.mcmpHandler, server, service, engine, host, context);
+
+ boolean result = this.listener.enable(hostName, path);
+
+ EasyMock.verify(this.serverProvider, this.requestFactory, this.mcmpHandler, server, service, engine, host, context);
+
+ Assert.assertTrue(result);
+ }
+
+ @SuppressWarnings("boxing")
+ @Test
+ public void disableContext()
+ {
+ String hostName = "host1";
+ String path = "/";
+
+ Server server = EasyMock.createStrictMock(Server.class);
+ Service service = EasyMock.createStrictMock(Service.class);
+ Engine engine = EasyMock.createStrictMock(Engine.class);
+ Host host = EasyMock.createStrictMock(Host.class);
+ Context context = EasyMock.createStrictMock(Context.class);
+ MCMPRequest request = EasyMock.createMock(MCMPRequest.class);
+
+ EasyMock.expect(this.serverProvider.getServer()).andReturn(server);
+ EasyMock.expect(server.findServices()).andReturn(new Service[] { service });
+ EasyMock.expect(service.getContainer()).andReturn(engine);
+ EasyMock.expect(engine.findChild(hostName)).andReturn(host);
+ EasyMock.expect(host.findChild(path)).andReturn(context);
+
+ EasyMock.expect(this.requestFactory.createDisableRequest(context)).andReturn(request);
+
+ EasyMock.expect(this.mcmpHandler.sendRequest(request)).andReturn(null);
+
+ EasyMock.expect(this.mcmpHandler.isProxyHealthOK()).andReturn(true);
+
+ EasyMock.replay(this.serverProvider, this.requestFactory, this.mcmpHandler, server, service, engine, host, context);
+
+ boolean result = this.listener.disable(hostName, path);
+
+ EasyMock.verify(this.serverProvider, this.requestFactory, this.mcmpHandler, server, service, engine, host, context);
+
+ Assert.assertTrue(result);
+ }
}
Modified: trunk/mod_cluster/src/test/java/org/jboss/modcluster/ha/HAModClusterServiceTestCase.java
===================================================================
--- trunk/mod_cluster/src/test/java/org/jboss/modcluster/ha/HAModClusterServiceTestCase.java 2009-04-22 11:23:17 UTC (rev 2399)
+++ trunk/mod_cluster/src/test/java/org/jboss/modcluster/ha/HAModClusterServiceTestCase.java 2009-04-22 18:22:05 UTC (rev 2400)
@@ -24,7 +24,9 @@
import java.util.Collections;
import java.util.Map;
+import org.apache.catalina.Context;
import org.apache.catalina.Engine;
+import org.apache.catalina.Host;
import org.apache.catalina.Lifecycle;
import org.apache.catalina.LifecycleEvent;
import org.apache.catalina.LifecycleListener;
@@ -257,6 +259,76 @@
}
@Test
+ public void enableContext()
+ {
+ String hostName = "host1";
+ String path = "/context";
+
+ Server server = EasyMock.createStrictMock(Server.class);
+ Service service = EasyMock.createStrictMock(Service.class);
+ Engine engine = EasyMock.createStrictMock(Engine.class);
+ Host host = EasyMock.createStrictMock(Host.class);
+ Context context = EasyMock.createStrictMock(Context.class);
+ MCMPRequest request = EasyMock.createMock(MCMPRequest.class);
+ Map<MCMPServerState, String> emptyMap = Collections.emptyMap();
+
+ EasyMock.expect(this.serverProvider.getServer()).andReturn(server);
+ EasyMock.expect(server.findServices()).andReturn(new Service[] { service });
+ EasyMock.expect(service.getContainer()).andReturn(engine);
+ EasyMock.expect(engine.findChild(hostName)).andReturn(host);
+ EasyMock.expect(host.findChild(path)).andReturn(context);
+
+ EasyMock.expect(this.requestFactory.createEnableRequest(context)).andReturn(request);
+
+ EasyMock.expect(this.clusteredMCMPHandler.sendRequest(request)).andReturn(emptyMap);
+
+ EasyMock.expect(this.clusteredMCMPHandler.isProxyHealthOK()).andReturn(true);
+
+ EasyMock.replay(this.serverProvider, this.requestFactory, this.clusteredMCMPHandler, server, service, engine, host, context);
+
+ boolean result = this.service.enable(hostName, path);
+
+ EasyMock.verify(this.serverProvider, this.requestFactory, this.clusteredMCMPHandler, server, service, engine, host, context);
+
+ Assert.assertTrue(result);
+ }
+
+ @Test
+ public void disableContext()
+ {
+ String hostName = "host1";
+ String path = "/context";
+
+ Server server = EasyMock.createStrictMock(Server.class);
+ Service service = EasyMock.createStrictMock(Service.class);
+ Engine engine = EasyMock.createStrictMock(Engine.class);
+ Host host = EasyMock.createStrictMock(Host.class);
+ Context context = EasyMock.createStrictMock(Context.class);
+ MCMPRequest request = EasyMock.createMock(MCMPRequest.class);
+ Map<MCMPServerState, String> emptyMap = Collections.emptyMap();
+
+ EasyMock.expect(this.serverProvider.getServer()).andReturn(server);
+ EasyMock.expect(server.findServices()).andReturn(new Service[] { service });
+ EasyMock.expect(service.getContainer()).andReturn(engine);
+ EasyMock.expect(engine.findChild(hostName)).andReturn(host);
+ EasyMock.expect(host.findChild(path)).andReturn(context);
+
+ EasyMock.expect(this.requestFactory.createDisableRequest(context)).andReturn(request);
+
+ EasyMock.expect(this.clusteredMCMPHandler.sendRequest(request)).andReturn(emptyMap);
+
+ EasyMock.expect(this.clusteredMCMPHandler.isProxyHealthOK()).andReturn(true);
+
+ EasyMock.replay(this.serverProvider, this.requestFactory, this.clusteredMCMPHandler, server, service, engine, host, context);
+
+ boolean result = this.service.disable(hostName, path);
+
+ EasyMock.verify(this.serverProvider, this.requestFactory, this.clusteredMCMPHandler, server, service, engine, host, context);
+
+ Assert.assertTrue(result);
+ }
+
+ @Test
public void lifecycleEvent()
{
LifecycleEvent event = new LifecycleEvent(EasyMock.createMock(Lifecycle.class), Lifecycle.INIT_EVENT);
15 years, 8 months
JBoss Native SVN: r2399 - trunk/build/unix.
by jbossnative-commits@lists.jboss.org
Author: jfrederic.clere(a)jboss.com
Date: 2009-04-22 07:23:17 -0400 (Wed, 22 Apr 2009)
New Revision: 2399
Modified:
trunk/build/unix/buildbin.mod_cluster.sh
Log:
ant installhttpd needs parameters...
Modified: trunk/build/unix/buildbin.mod_cluster.sh
===================================================================
--- trunk/build/unix/buildbin.mod_cluster.sh 2009-04-22 10:30:54 UTC (rev 2398)
+++ trunk/build/unix/buildbin.mod_cluster.sh 2009-04-22 11:23:17 UTC (rev 2399)
@@ -233,7 +233,8 @@
# Install httpd using the ant script in mod_cluster
(cd ../mod_cluster/test/java
- ant installhttpd
+ echo "Running: ant installhttpd -DBUILDTEST=Y -Dbuild_version=${build_version} -Droot=${output_loc}"
+ ant installhttpd -DBUILDTEST=Y -Dbuild_version=${build_version} -Droot=${output_loc}
)
# Build the *.so for any httpd-2.2.x using the httpd install done before
15 years, 8 months
JBoss Native SVN: r2398 - trunk/build/unix.
by jbossnative-commits@lists.jboss.org
Author: jfrederic.clere(a)jboss.com
Date: 2009-04-22 06:30:54 -0400 (Wed, 22 Apr 2009)
New Revision: 2398
Modified:
trunk/build/unix/buildbin.mod_cluster.sh
Log:
Install httpd before using the install to build so bundles.
Modified: trunk/build/unix/buildbin.mod_cluster.sh
===================================================================
--- trunk/build/unix/buildbin.mod_cluster.sh 2009-04-22 09:40:22 UTC (rev 2397)
+++ trunk/build/unix/buildbin.mod_cluster.sh 2009-04-22 10:30:54 UTC (rev 2398)
@@ -231,7 +231,12 @@
cp target/*-bin.* ${build_top}/output
)
-# Build the *.so for any httpd-2.2.x using the httpd install of the previous run
+# Install httpd using the ant script in mod_cluster
+(cd ../mod_cluster/test/java
+ ant installhttpd
+)
+
+# Build the *.so for any httpd-2.2.x using the httpd install done before
if [ "${BUILD_SYS}" != "windows" ]; then
BASELOC=`(cd ../mod_cluster/test/java; ant base | grep echo | sed 's:\[echo\]::' | sed 's:^ *::')`
for dir in `echo mod_proxy mod_manager advertise mod_slotmem mod_proxy_cluster`
15 years, 8 months