I think this is the right track. Use 3 "abstractions" : 1. Connection - getConnection, sendMessage, getMessage 2. MsgBuff - marshaling 3. RemoteMethod - the actual code ( apache methods, callbacks, etc). In future, a "tomcat connector" will consist in 3 apache modules: - connection - encoding - rmethod Configuration magic will decide what to use and how. Modules will communicate using the module private configuration. Apache can get a pointer to it based on module name, and we will have method * as fields ( and of course, modules will share the .h files). Maybe we can use apache hooks for more advanced stuff, but I don't think we should jump to soon. Right now we have some compilation magic to combine the 3 elements, and data structures are not yet finalized. ( probably most common stuff will go to a shared library, right now we just do define and includes) NOTE: you can override any level if your protocol can do better. For example, the embeded JVM connector will have no encoding ( just pass the real data pointers ). ( ok, rmethods will needs to be splited in skel + impl ). Load balancing Need to move the load balancing stuff from jserv in a separate module that can work with any protocol. Just set a note with the server to be used. Problems: /* XXX Current code use some ugly pre-processing magic and name conventions to simulate sort of OO. */ /* XXX The protocol is not final - I just want to have something the run, to get a feeling of how it works. Next thing must be to do test variations of the protocol, that will minimize the overhead. You can add to this file ( if it is an improvement to the current protocol) or create a new mod_xxx.c and xxxConnectionHandler if it's a new protocol. */ /** XXX sending the body is not implemented yet, post will not work. We want to do the trick with "passing an open file descriptor using Unix sockets or pipes or doors" - and also need to figure if it's better to send the body with the request or in a callback. */ /* XXX Add an initial packet to server - auth, etc */ /* XXX Not very nice, but need to figure out how to deal with non-static functions imported in different modules, how to deal with inter-module communication, etc. */