costin 01/12/07 15:10:34
Modified: jk/native2/include jk_endpoint.h jk_objCache.h jk_worker.h
Log:
Finish jk_objCache, start using it in jk_worker.
( the code is moved from ajp13_worker ). I added it to lb_worker, not yet to
jni - but it may be usefull in few other places as well.
Make sure the 'per connection' pool in endpoint is different from the
'main' pool ( that has the same life as the endpoint ).
It seems the objCache code is a bit inefficient, I don't know why it works
the way it does ( it could just be a stack ).
Revision Changes Path
1.4 +9 -3 jakarta-tomcat-connectors/jk/native2/include/jk_endpoint.h
Index: jk_endpoint.h
===================================================================
RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/include/jk_endpoint.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- jk_endpoint.h 2001/12/06 22:48:49 1.3
+++ jk_endpoint.h 2001/12/07 23:10:34 1.4
@@ -61,7 +61,7 @@
* Author: Gal Shachor <[EMAIL PROTECTED]>
* Author: Dan Milstein <[EMAIL PROTECTED]>
* Author: Henri Gomez <[EMAIL PROTECTED]>
- * Version: $Revision: 1.3 $
+ * Version: $Revision: 1.4 $
***************************************************************************/
#ifndef JK_ENDPOINT_H
@@ -127,9 +127,15 @@
struct jk_worker *worker;
- /** Each thread has it's own endpoint instance and is recycled.
- This pool can be unsynchronized */
+ /** 'main' pool for this endpoint. Used to store properties of the
+ endpoint. Will be alive until the endpoint is destroyed.
+ */
jk_pool_t *pool;
+
+ /** Connection pool. Used to store temporary data. It'll be
+ recycled after each transaction.
+ */
+ jk_pool_t *cPool;
int proto; /* PROTOCOL USED AJP13/AJP14 */
1.2 +13 -0 jakarta-tomcat-connectors/jk/native2/include/jk_objCache.h
Index: jk_objCache.h
===================================================================
RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native2/include/jk_objCache.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- jk_objCache.h 2001/12/06 22:40:41 1.1
+++ jk_objCache.h 2001/12/07 23:10:34 1.2
@@ -69,7 +69,14 @@
#endif /* __cplusplus */
struct jk_objCache;
+struct jk_logger;
+struct jk_pool;
typedef struct jk_objCache jk_objCache_t;
+
+#define JK_OBJCACHE_DEFAULT_SZ (128)
+
+
+jk_objCache_t *jk_objCache_create(struct jk_pool *pool, struct jk_logger *l );
/**
* Simple object cache ( or pool for java people - don't confuse with the
@@ -92,10 +99,16 @@
void *(*get)(jk_objCache_t *_this);
+ int (*init)(jk_objCache_t *_this, int cacheSize);
+
+ int (*destroy)(jk_objCache_t *_this);
+
/* private, move to impl ( if any other impl is available) */
int ep_cache_sz;
JK_CRIT_SEC cs;
void **ep_cache;
+ struct jk_logger *l;
+ struct jk_pool *pool;
};
#ifdef __cplusplus
1.5 +11 -5 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.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- jk_worker.h 2001/12/06 22:48:49 1.4
+++ jk_worker.h 2001/12/07 23:10:34 1.5
@@ -58,7 +58,7 @@
/***************************************************************************
* Description: Workers controller header file *
* Author: Gal Shachor <[EMAIL PROTECTED]> *
- * Version: $Revision: 1.4 $ *
+ * Version: $Revision: 1.5 $ *
***************************************************************************/
#ifndef JK_WORKER_H
@@ -70,6 +70,7 @@
#include "jk_map.h"
#include "jk_mt.h"
#include "jk_uriMap.h"
+#include "jk_objCache.h"
#ifdef __cplusplus
extern "C" {
@@ -78,6 +79,7 @@
struct jk_worker;
struct jk_endpoint;
struct jk_env;
+struct jk_objCache;
typedef struct jk_worker jk_worker_t;
@@ -194,7 +196,11 @@
sort out after */
struct sockaddr_in worker_inet_addr; /* Contains host and port */
int connect_retry_attempts;
-
+
+ /** Reuse the endpoint and it's connection
+ */
+ struct jk_objCache *endpointCache;
+
/*
* Open connections cache...
*
@@ -202,9 +208,9 @@
* 2. Cache size.
* 3. An array of "open" endpoints.
*/
- JK_CRIT_SEC cs;
- int ep_cache_sz;
- struct jk_endpoint **ep_cache;
+ /* JK_CRIT_SEC cs; */
+ /* int ep_cache_sz; */
+ /* struct jk_endpoint **ep_cache; */
int proto;
struct jk_login_service *login;
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>