Author: jfrederic.clere(a)jboss.com
Date: 2008-05-15 10:22:27 -0400 (Thu, 15 May 2008)
New Revision: 1606
Added:
trunk/mod_cluster/native/include/mod_proxy_cluster.h
Modified:
trunk/mod_cluster/native/mod_manager/mod_manager.c
Log:
Add the provider logic for ping/pong.
Added: trunk/mod_cluster/native/include/mod_proxy_cluster.h
===================================================================
--- trunk/mod_cluster/native/include/mod_proxy_cluster.h (rev 0)
+++ trunk/mod_cluster/native/include/mod_proxy_cluster.h 2008-05-15 14:22:27 UTC (rev
1606)
@@ -0,0 +1,42 @@
+/*
+ * 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$
+ */
+
+#ifndef MOD_PROXY_CLUSTER_H
+#define MOD_PROXY_CLUSTER_H
+struct balancer_method {
+/**
+ * Check that the node is responding
+ * @param r request_rec structure.
+ * @param id ident of the worker.
+ * @param load load factor to set if test is ok.
+ * @param scheme AJP/http/https protocol to use.
+ * @return 0: All OK 500 : Error
+ */
+APR_DECLARE(int) (* proxy_node_isup)(request_rec *r, int id, char *scheme, int load);
+};
+typedef struct balancer_method balancer_method;
+#endif /*MOD_PROXY_CLUSTER_H*/
Modified: trunk/mod_cluster/native/mod_manager/mod_manager.c
===================================================================
--- trunk/mod_cluster/native/mod_manager/mod_manager.c 2008-05-15 14:21:28 UTC (rev 1605)
+++ trunk/mod_cluster/native/mod_manager/mod_manager.c 2008-05-15 14:22:27 UTC (rev 1606)
@@ -1,15 +1,28 @@
/*
- Copyright 2008 Red Hat Middleware, LLC.
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
-
http://www.apache.org/licenses/LICENSE-2.0
- Unless required by applicable law or agreed to in writing, software distributed
- under the License is distributed on an "AS IS" BASIS,i
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
+ * 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$
*/
#include "apr_strings.h"
@@ -24,6 +37,8 @@
#include "http_core.h"
#include "scoreboard.h"
+#include "mod_proxy_cluster.h"
+
#include "slotmem.h"
#include "node.h"
@@ -42,6 +57,7 @@
mem_t *balancerstatsmem = NULL;
slotmem_storage_method *storage = NULL;
+balancer_method *balancerhandler = NULL;
module AP_MODULE_DECLARE_DATA manager_module;
@@ -207,7 +223,12 @@
return !OK;
}
- // sharedmem_initialize_cleanup(p);
+ /* Get a provider to ping/pong logics */
+
+ balancerhandler = ap_lookup_provider("proxy_cluster", "balancer",
"0");
+ if (balancerhandler == NULL) {
+ ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_WARNING, 0, s, "can't find
a ping/pong logic");
+ }
return OK;
}
static char **process_buff(request_rec *r, char *buff)
@@ -563,11 +584,14 @@
}
/*
- * XXX: Need to be write the idea is to get a provider for mod_proxy_cluster for each
scheme.
+ * Call the ping/pong logic
* Do a ping/png request to the node and set the load factor.
*/
static int isnode_up(request_rec *r, int id, char *scheme, int Load)
{
+ if (balancerhandler != NULL) {
+ return (balancerhandler->proxy_node_isup(r, id, scheme, Load));
+ }
return OK;
}
/*