This is the mail archive of the java@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: CNI from apache module


Lars Andersen wrote:
> 
> The news section mentions that it is possible to interface an apache 
> module to java thru CNI (I guess?).

Attached is the code I wrote.  This is for Apache 2.0.16.  It goes into
the modules sub-directory.  You configure with -enable-so --enable-gccsp

There are some issues with threading.  I experimented with both
--with-mpm=prefork and --with-mpm-threaded.  You'd like to use use 
'threaded', both for performance and because you want all "servlets"
to share a single JVM.  However, then you may have to kludge various
things.  For example you need to make sure that gc.h is included so
that the GC can be notified of thread changes.  I tried #include <gc.h>
in srclib/apr/pthread.h.

It's been a while since I worked on this, and I don't remember what
worked and what didn't.  I didn't get it far enough to be useful.
Ideally, you'd want a mdoule that can run real servlets, and that's
a lot of work.  If you just to write modules in Java without using
servlets it may not be as much work, and if you start with my code,
at least you'll have something that can grow into a servlet container.

If you succeed in producing something useful, you may need to patch
some of the core (non-module) files, for example to make sure gc.h
is included where it needs to.  Hopefully, Apache will be willing
to accept the patches, if they're clean enough.

If you're willing to spend time on it, I give you my blessing.
It could be cool to run gcj-compiled servlets (even if only a
subset of the servlet spec is implemented) directly on apache.
If you have any questions, feel free to ask.
-- 
	--Per Bothner
per@bothner.com   http://www.bothner.com/per/

Attachment: gccsp.tgz
Description: GNU Zip compressed data

--- ./srclib/apr/threadproc/unix/signals.c~	Tue Feb 27 18:16:07 2001
+++ ./srclib/apr/threadproc/unix/signals.c	Mon Aug 27 20:51:20 2001
@@ -280,6 +280,10 @@
      * unblockable signals are included in the mask.  This was first 
      * observed on AIX and Tru64.
      */
+#if 0
+    sigdelset(&sig_mask, SIGPWR);
+    sigdelset(&sig_mask, SIGXCPU);
+#endif
 #ifdef SIGKILL
     sigdelset(&sig_mask, SIGKILL);
 #endif
--- ./server/mpm/threaded/threaded.c~	Tue Apr  3 11:50:07 2001
+++ ./server/mpm/threaded/threaded.c	Mon Aug 27 21:15:42 2001
@@ -146,7 +146,7 @@
  * Continue through and you'll be fine.).
  */
 
-static int one_process = 0;
+static int one_process = 1;
 
 #ifdef DEBUG_SIGSTOP
 int raise_sigstop_flags;
@@ -325,7 +325,7 @@
     if (sigaction(SIGINT, &sa, NULL) < 0)
         ap_log_error(APLOG_MARK, APLOG_WARNING, errno, ap_server_conf, "sigaction(SIGINT)");
 #endif
-#ifdef SIGXCPU
+#if 0
     sa.sa_handler = SIG_DFL;
     if (sigaction(SIGXCPU, &sa, NULL) < 0)
 	ap_log_error(APLOG_MARK, APLOG_WARNING, errno, ap_server_conf, "sigaction(SIGXCPU)");
@@ -364,7 +364,7 @@
 #ifdef SIGILL
 	apr_signal(SIGILL, sig_coredump);
 #endif /* SIGILL */
-#ifdef SIGXCPU
+#if 0 /*def SIGXCPU*/
 	apr_signal(SIGXCPU, SIG_DFL);
 #endif /* SIGXCPU */
 #ifdef SIGXFSZ
@@ -659,12 +659,14 @@
     apr_threadattr_create(&thread_attr, pchild);
     apr_threadattr_detach_set(thread_attr);
 
+#if 0
     rv = apr_create_signal_thread(&thread, thread_attr, check_signal, pchild);
     if (rv != APR_SUCCESS) {
         ap_log_error(APLOG_MARK, APLOG_EMERG, rv, ap_server_conf,
                      "Couldn't create signal thread");
         clean_child_exit(APEXIT_CHILDFATAL);
     }
+#endif
 
     for (i=0; i < ap_threads_per_child - 1; i++) {
 
@@ -1152,7 +1154,7 @@
     static int restart_num = 0;
     int no_detach = 0;
 
-    one_process = !!ap_exists_config_define("ONE_PROCESS");
+    /*one_process = !!ap_exists_config_define("ONE_PROCESS");*/
     no_detach = !!ap_exists_config_define("NO_DETACH");
 
     /* sigh, want this only the second time around */
@@ -1183,7 +1185,7 @@
 
 static void threaded_hooks(apr_pool_t *p)
 {
-    one_process = 0;
+  /*one_process = 0;*/
 
     ap_hook_pre_config(threaded_pre_config, NULL, NULL, APR_HOOK_MIDDLE);
 }

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]