Design OverviewIn order to combine Java's threaded processing with Apache's forked processing mode, mod_gcj loads and runs Java code in a separate server process that hosts the GCJ runtime. The GCJ server process is created by forking when the module is first activated, and then exec()ing an external program called mod-gcj-server located in the apache bin directory. The reason to put the GCJ server code into a separate executable is so that we can implement the module in plain C rather than C++ and get rid of any GCJ dependencies in the module itself. The GCJ module is written in C, while the GCJ server consists of some C++ mostly for Unix domain socket communication, and is otherwise mostly written in Java. It is multithreaded using GCJ java threads. The fact that the GCJ server is executing in a separate process is largely invisible to users/administrators:
In the future it may be possible to interact with other Apache modules from Java code, implement Apache hooks in Java etc. CreditsAfter coming up with this design blueprint, I found out that mod_mono uses pretty much the same approach to implement ASP.NET for Apache. Thanks go to the authors of mod_mono, Daniel Lopez Ridruejo and Gonzalo Paniagua Javuer, for allowing me to use their work to get started with mod_gcj. This has allowed me to get some useful code much faster than it would have been otherwise. |
Mod_GCJ
Rhinola
|