Hi,

Dunno if the patch has the 'real' purpose, cause it's only a way for me
to make the config easier to configure.
Since -Djava.class.path in JVM options can contain classpaths semicolon
separated, it can become quite messy, so I've used the concept to enable
to use multiple config lines and it will become the semicolon separated
after parsing.

So it enables to use the workers2.properties in a following way:

[vm:]
info=Parameters used to load a JVM in the server process
OPT=-Djava.class.path=${TOMCAT_HOME}/bin/tomcat-jni.jar
OPT=-Djava.class.path=${APACHE2_HOME}/bin/modjava.jar
OPT=-Djava.class.path=${APACHE2_HOME}/modules/java
OPT=-Dtomcat.home=${TOMCAT_HOME}
OPT=-Dcatalina.home=${TOMCAT_HOME}
OPT=-Xmx128M
disabled=0

Of course you could put that in the single line but IMO it's easier to
admin this way.

The patch works only if the APR is enabled, and if not falls to the
standard behavior.

MT.
Index: jk_vm_default.c
===================================================================
RCS file: /home/cvspublic/jakarta-tomcat-connectors/jk/native2/common/jk_vm_default.c,v
retrieving revision 1.16
diff -u -r1.16 jk_vm_default.c
--- jk_vm_default.c 1 Jun 2002 15:40:09 -0000   1.16
+++ jk_vm_default.c 9 Jun 2002 17:03:31 -0000
@@ -101,6 +101,10 @@
 
 #include <jni.h>
 
+#ifdef HAS_APR
+#include "apr_strings.h"
+#endif
+
 #ifdef APR_HAS_DSO
 #include "apr_dso.h"
 #endif
@@ -367,7 +371,7 @@
     }
     if( jkvm->mbean->debug > 0 )
         env->l->jkLog(env, env->l, JK_LOG_INFO, "vm.attach() ok\n");
-    return rc;
+    return (void *)rc;
 }
 
 
@@ -535,7 +539,7 @@
             return JK_ERR;
         }
 
-        jkvm->jvm=jvm;
+        jkvm->jvm=(void *)jvm;
         return JK_OK;
     } else if( err!=0 ) {
        env->l->jkLog(env, env->l, JK_LOG_EMERG,
@@ -543,7 +547,7 @@
         return JK_ERR;
     }
 
-    jkvm->jvm=jvm;
+    jkvm->jvm=(void *)jvm;
 
     env->l->jkLog(env, env->l, JK_LOG_INFO,
                   "vm.open2() done\n");
@@ -558,8 +562,32 @@
     char *value=valueP;
     
     if( strcmp( name, "OPT" )==0 ) {
-        jkvm->options[jkvm->nOptions]=value;
-        jkvm->nOptions++;
+#ifdef HAS_APR
+       int n=0;
+       if( strncmp( value, "-Djava.class.path=", sizeof("-Djava.class.path=")-1)==0) {
+           int i;
+           apr_pool_t *p = (apr_pool_t *)env->globalPool->_private;
+
+           for( i=0; i<jkvm->nOptions; i++ ) {
+               if ( strncmp( jkvm->options[i], "-Djava.class.path=", 
+                             sizeof("-Djava.class.path=")-1)==0) {
+                   jkvm->options[i]=apr_pstrcat(p,
+                                             jkvm->options[i],
+                                             ";", value + 
+sizeof("-Djava.class.path=")-1,
+                                             NULL);
+                   n=1;
+                   break;
+               }
+           }
+       }
+       if( !n) {
+           jkvm->options[jkvm->nOptions]=value;
+           jkvm->nOptions++;
+       }
+#else      
+       jkvm->options[jkvm->nOptions]=value;
+       jkvm->nOptions++;
+#endif
     } else if( strcmp( name, "JVM" )==0 ) {
         jkvm->jvm_dll_path=value;
     } else {

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to