You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by co...@apache.org on 2002/05/09 01:47:27 UTC
cvs commit: jakarta-tomcat-connectors/jk/native2/include jk_bean.h jk_config.h jk_env.h jk_uriEnv.h jk_worker.h jk_workerEnv.h
costin 02/05/08 16:47:27
Modified: jk/native2/include jk_config.h jk_env.h jk_uriEnv.h
jk_worker.h jk_workerEnv.h
Added: jk/native2/include jk_bean.h
Log:
- expose the 'save' method in config
- move the 'bean' ( i.e. the jk component ) to a separate file, a bit better
documentations
- added 'debug' and 'disabled' in bean, since all components will need that.
- added a 'config' into jk_uriEnv, so we can later use separate files
for each vhost/context
- added a 'priority' in the worker ( to be used for 'local workers' )
Revision Changes Path
1.4 +6 -1 jakarta-tomcat-connectors/jk/native2/include/jk_config.h
Index: jk_config.h
===================================================================
RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/include/jk_config.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- jk_config.h 26 Mar 2002 02:55:15 -0000 1.3
+++ jk_config.h 8 May 2002 23:47:27 -0000 1.4
@@ -96,7 +96,12 @@
*/
int (*setProperty)(struct jk_env *env, struct jk_config *cfg,
struct jk_bean *target, char *name, char *value);
-
+
+ /** Write the config file. If targetFile is NULL, it'll override the
+ * file that was used for reading
+ */
+ int (*save)( struct jk_env *env, struct jk_config *cfg,
+ char *targetFile);
/** Read the properties from the file, doing $(prop) substitution
1.15 +1 -81 jakarta-tomcat-connectors/jk/native2/include/jk_env.h
Index: jk_env.h
===================================================================
RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/include/jk_env.h,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- jk_env.h 3 May 2002 17:36:46 -0000 1.14
+++ jk_env.h 8 May 2002 23:47:27 -0000 1.15
@@ -67,6 +67,7 @@
#include "jk_pool.h"
#include "jk_map.h"
#include "jk_worker.h"
+#include "jk_bean.h"
#define JK_LINE __FILE__,__LINE__
@@ -88,27 +89,10 @@
struct jk_logger;
struct jk_map;
struct jk_bean;
-typedef struct jk_bean jk_bean_t;
typedef struct jk_env jk_env_t;
extern struct jk_env *jk_env_globalEnv;
-/**
- * Factory used to create all jk objects. Factories are registered with
- * jk2_env_registerFactory. The 'core' components are registered in
- * jk_registry.c
- *
- * Each jk component must be configurable using the setAttribute methods
- * in jk_bean. The factory is responsible to set up the config methods.
- *
- * The mechanism provide modularity and manageability to jk.
- */
-typedef int (JK_METHOD *jk_env_objectFactory_t)(jk_env_t *env,
- struct jk_pool *pool,
- struct jk_bean *mbean,
- const char *type,
- const char *name);
-
/** Get a pointer to the jk_env. We could support multiple
* env 'instances' in future - for now it's a singleton.
*/
@@ -125,70 +109,6 @@
};
typedef struct jk_exception jk_exception_t;
-
-
-/** Each jk object will use this mechanism for configuration
- * XXX Should it be named mbean ?
- */
-struct jk_bean {
- /* Type of this object
- */
- char *type;
-
- /* Name of the object
- */
- char *name;
-
- /* Local part of the name
- */
- char *localName;
-
- /* The wrapped object
- */
- void *object;
-
- /** Unprocessed settings that are set on this bean by the config
- apis ( i.e. with $() in it ).
-
- It'll be != NULL for each component that was created or set using
- jk_config.
- */
- struct jk_map *settings;
-
- /* Object pool. The jk_bean and the object itself are created in this
- * pool. If this pool is destroyed or recycled, the object and all its
- * data are destroyed as well ( assuming the pool corectly cleans child pools
- * and object data are not created explicitely in a different pool ).
- */
- struct jk_pool *pool;
-
- /* Temp - will change !*/
- /* Attributes supported by getAttribute method */
- char **getAttributeInfo;
-
- /* Attributes supported by setAttribute method */
- char **setAttributeInfo;
-
- /** Set a jk property. This is similar with the mechanism
- * used by java side ( with individual setters for
- * various properties ), except we use a single method
- * and a big switch
- *
- * As in java beans, setting a property may have side effects
- * like changing the log level or reading a secondary
- * properties file.
- *
- * Changing a property at runtime will also be supported for
- * some properties.
- * XXX Document supported properties as part of
- * workers.properties doc.
- * XXX Implement run-time change in the status/ctl workers.
- */
- int ( JK_METHOD *setAttribute)(struct jk_env *env, struct jk_bean *bean,
- char *name, void *value );
-
- void * ( JK_METHOD *getAttribute)(struct jk_env *env, struct jk_bean *bean, char *name );
-};
/**
* The env will be used in a similar way with the JniEnv, to provide
1.12 +10 -0 jakarta-tomcat-connectors/jk/native2/include/jk_uriEnv.h
Index: jk_uriEnv.h
===================================================================
RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/include/jk_uriEnv.h,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- jk_uriEnv.h 30 Apr 2002 06:41:18 -0000 1.11
+++ jk_uriEnv.h 8 May 2002 23:47:27 -0000 1.12
@@ -184,6 +184,16 @@
struct jk_map *prefixMatch;
struct jk_map *suffixMatch;
+ /** For MATCH_TYPE_CONTEXT, the config used to read properties
+ for that context.
+ For MATCH_TYPE_HOST, the config used to read contexts
+ For MATCH_TYPE_HOST/default it also contains all vhosts
+
+ If NULL - no config was attached.
+ ( this will be used in future for run-time deployment )
+ */
+ struct jk_config *config;
+
/* -------------------- Other properties -------------------- */
1.18 +24 -7 jakarta-tomcat-connectors/jk/native2/include/jk_worker.h
Index: jk_worker.h
===================================================================
RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/include/jk_worker.h,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -r1.17 -r1.18
--- jk_worker.h 3 May 2002 17:36:46 -0000 1.17
+++ jk_worker.h 8 May 2002 23:47:27 -0000 1.18
@@ -58,7 +58,7 @@
/***************************************************************************
* Description: Workers controller header file *
* Author: Gal Shachor <sh...@il.ibm.com> *
- * Version: $Revision: 1.17 $ *
+ * Version: $Revision: 1.18 $ *
***************************************************************************/
#ifndef JK_WORKER_H
@@ -158,10 +158,6 @@
/* -------------------- Information used for load balancing ajp workers -------------------- */
- /* Worker is in gracefull shutdown
- */
- int disabled;
-
/** The id of the tomcat instance we connect to. We may have multiple
workers connecting to a single tomcat. If no route is defined,
the worker name will be the route name. The route can be the
@@ -169,8 +165,14 @@
*/
char *route;
+ /* Number of requests served by this worker and the number of errors */
int reqCnt;
int errCnt;
+
+ /* Total time ( for average - divide by reqCnt ) and maxTime */
+ /* XXX Not used curently. XXX Mutex for mt access */
+ long time;
+ long maxTime;
/** lb groups in which this worker belongs */
struct jk_map *groups;
@@ -181,12 +183,27 @@
*/
double lb_factor;
double lb_value;
+
+ /* Time when the last error occured on this worker */
+ time_t error_time;
+
+ /* In error state. Will return to normal state after a timeout
+ * ( number of requests or time ), if no other worker is active
+ * or when the configuration changes.
+ */
int in_error_state;
+
+ /* Worker priority.
+ * Workers with lower priority are allways preffered - regardless of lb_value
+ * This is user to represent 'local' workers ( we can call it 'proximity' or 'distance' )
+ */
+ int priority;
+
+ /* I have no idea what it means... */
int in_recovering;
+ /* I have no idea why we need this */
int retry_count;
- time_t error_time;
-
/* -------------------- Information for reconfiguration -------------------- */
/* Only one thread can update the config
1.18 +3 -3 jakarta-tomcat-connectors/jk/native2/include/jk_workerEnv.h
Index: jk_workerEnv.h
===================================================================
RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/include/jk_workerEnv.h,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -r1.17 -r1.18
--- jk_workerEnv.h 7 May 2002 19:42:40 -0000 1.17
+++ jk_workerEnv.h 8 May 2002 23:47:27 -0000 1.18
@@ -58,7 +58,7 @@
/***************************************************************************
* Description: Workers controller header file *
* Author: Gal Shachor <sh...@il.ibm.com> *
- * Version: $Revision: 1.17 $ *
+ * Version: $Revision: 1.18 $ *
***************************************************************************/
#ifndef JK_WORKERENV_H
@@ -121,8 +121,8 @@
/* Dispatcher for shm ( JNI -> web server ) */
#define JK_HANDLE_SHM_DISPATCH 0x16
-/* Dispatcher for apr channel ( JNI -> web server ) */
-#define JK_HANDLE_CHANNELAPR_DISPATCH 0x17
+/* Dispatcher for unix socket channel ( JNI -> web server ) */
+#define JK_HANDLE_UN_DISPATCH 0x17
/*
1.1 jakarta-tomcat-connectors/jk/native2/include/jk_bean.h
Index: jk_bean.h
===================================================================
/* ========================================================================= *
* *
* The Apache Software License, Version 1.1 *
* *
* Copyright (c) 1999-2001 The Apache Software Foundation. *
* All rights reserved. *
* *
* ========================================================================= *
* *
* Redistribution and use in source and binary forms, with or without modi- *
* fication, are permitted provided that the following conditions are met: *
* *
* 1. Redistributions of source code must retain the above copyright notice *
* notice, this list of conditions and the following disclaimer. *
* *
* 2. Redistributions in binary form must reproduce the above copyright *
* notice, this list of conditions and the following disclaimer in the *
* documentation and/or other materials provided with the distribution. *
* *
* 3. The end-user documentation included with the redistribution, if any, *
* must include the following acknowlegement: *
* *
* "This product includes software developed by the Apache Software *
* Foundation <http://www.apache.org/>." *
* *
* Alternately, this acknowlegement may appear in the software itself, if *
* and wherever such third-party acknowlegements normally appear. *
* *
* 4. The names "The Jakarta Project", "Jk", and "Apache Software *
* Foundation" must not be used to endorse or promote products derived *
* from this software without prior written permission. For written *
* permission, please contact <ap...@apache.org>. *
* *
* 5. Products derived from this software may not be called "Apache" nor may *
* "Apache" appear in their names without prior written permission of the *
* Apache Software Foundation. *
* *
* THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED WARRANTIES *
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY *
* AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL *
* THE APACHE SOFTWARE FOUNDATION OR ITS CONTRIBUTORS BE LIABLE FOR ANY *
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL *
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS *
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) *
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, *
* STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN *
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE *
* POSSIBILITY OF SUCH DAMAGE. *
* *
* ========================================================================= *
* *
* This software consists of voluntary contributions made by many indivi- *
* duals on behalf of the Apache Software Foundation. For more information *
* on the Apache Software Foundation, please see <http://www.apache.org/>. *
* *
* ========================================================================= */
#ifndef JK_BEAN_H
#define JK_BEAN_H
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
#include "jk_global.h"
#include "jk_env.h"
#include "jk_logger.h"
#include "jk_pool.h"
#include "jk_map.h"
#include "jk_worker.h"
struct jk_pool;
struct jk_env;
struct jk_logger;
struct jk_map;
struct jk_bean;
typedef struct jk_bean jk_bean_t;
/**
* Factory used to create all jk objects. Factories are registered with
* jk2_env_registerFactory. The 'core' components are registered in
* jk_registry.c
*
* Each jk component must be configurable using the setAttribute methods
* in jk_bean. The factory is responsible to set up the config methods.
*
* The mechanism provide modularity and manageability to jk.
*/
typedef int (JK_METHOD *jk_env_objectFactory_t)(struct jk_env *env,
struct jk_pool *pool,
struct jk_bean *mbean,
const char *type,
const char *name);
/** Each jk object will use this mechanism for configuration
*
* Lifecycle:
* - object is created using env->createBean() or by jk_config ( if you want
* the object config to be saved )
*
* - the name is parsed and the 'type' and 'localName' extracted.
*
* - 'type' will be looked up in registry, to find jk_env_objectFactory_t
*
* - the factory method is called. It will create the object ( and eventually look
* up other objects )
*
* - setAttribute() is called for each configured property.
*
* - init() is called, after this the component is operational.
*
* - destroy() should clean up any resources ( the pool and all objects allocated
* in the pool can be cleaned up automatically )
*/
struct jk_bean {
/* Type of this object ( "channel.socket", "workerEnv", etc )
*/
char *type;
/* Full name of the object ( "channel.socket:localhost:8080" ).
* Used to construct the object.
*/
char *name;
/* Local part of the name ( localhost:8080 )
*/
char *localName;
/* The wrapped object ( points to the real struct: jk_worker_t *, jk_channel_t *, etc )
*/
void *object;
/** Common information - if not 0 the component should print
* verbose information about its operation
*/
int debug;
/* Common information - if set the component will not be
* initialized or used
*/
int disabled;
/** Unprocessed settings that are set on this bean by the config
apis ( i.e. with $() in it ).
It'll be != NULL for each component that was created or set using
jk_config.
This is what jk_config will save.
*/
struct jk_map *settings;
/* Object pool. The jk_bean and the object itself are created in this
* pool. If this pool is destroyed or recycled, the object and all its
* data are destroyed as well ( assuming the pool corectly cleans child pools
* and object data are not created explicitely in a different pool ).
*
* Object should create sub-pools if they want to create/destroy long-lived
* data, and env->tmpPool for data that is valid during the transaction.
*/
struct jk_pool *pool;
/* Temp - will change !*/
/* Attributes supported by getAttribute method */
char **getAttributeInfo;
/* Attributes supported by setAttribute method */
char **setAttributeInfo;
/** Set a jk property. This is similar with the mechanism
* used by java side ( with individual setters for
* various properties ), except we use a single method
* and a big switch
*
* As in java beans, setting a property may have side effects
* like changing the log level or reading a secondary
* properties file.
*
* Changing a property at runtime will also be supported for
* some properties.
* XXX Document supported properties as part of
* workers.properties doc.
* XXX Implement run-time change in the status/ctl workers.
*/
int ( JK_METHOD *setAttribute)(struct jk_env *env, struct jk_bean *bean,
char *name, void *value );
void *( JK_METHOD *getAttribute)(struct jk_env *env, struct jk_bean *bean, char *name );
/* Init the component
*/
int (JK_METHOD *init)(struct jk_env *env, struct jk_bean *bean);
int (JK_METHOD *destroy)(struct jk_env *env, struct jk_bean *bean );
};
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>