Single Process Launcher Guide 2024-1¶
Overview¶
This document is meant to be a developer documentation discussing technical details about GIFT single process mode.
Differences from Multi-Process Mode¶
Threading¶
The biggest difference between Single Process mode and Multi-Process mode is obviously the number of processes. With Multi-Process mode each GIFT module (including ActiveMQ) run in their dedicated process. In Single Process mode all of these services are brought under one process and each module is instead given a dedicated thread.
ClassLoaders¶
GIFT was originally developed under the mindset that each module was given their own process as stated in the Threading section. This leads to problems with the modules not being thread safe or not working as expected under a threaded environment. To emulate these conditions without re writing large portions of GIFT, Java ClassLoaders are used.
Normally in a threaded environment each thread will share a set of common resources (.jars), this led to problems in GIFT where each module was expecting to have the resources all to themselves. So a custom ClassLoader was implemented that let each module instance their own copy of the resources thus, emulating the original working conditions. This proved to be an effective solution to the thread-safety issues each module was experiencing.
Derby¶
Derby was selected as the database to use for Single Process mode since it is packaged with the latest version of Java and is easily embedded in process.
ActiveMQ¶
ActiveMQ was re configured to work as an embedded connection instead of running as a service.
Issues¶
Having different versions of the same JARs being loaded in a single process was causing problems in GIFT. This problem was solved using the ClassLoader solution described above. The conflicting JARs that were causing problems is as follows:
- Log4j (Loaded by GIFT common and ActiveMQ)
- Jetty (Loaded by Tutor Module and ActiveMQ)