I've got a change to ofbiz startup to make loading of the webapps run in parallel. Unfortunately, it's been taking me longer than I'd like to get working completely.
Catalina itself is single-threaded when loading the webapps attached to a particular host. That fix required me initializing the Context classes myself before adding to the host. Unfortunately, that had 2 concurrency bugs in catalina, that I had to hack around. One was yet another synchronization. The other was corruption when catalina tried to use a global static map to old intermediate data while parsing the web.xml files. However, once I got all those fixed, ofbiz itself stopped the parallelization. The startup code called by ControlServlet and ContextFilter end up calling into synchronized ofbiz blocks, which effectively stops things from running in parallel. My fix there is to remove the synchronized blocks, and switch to more concurrent type algos. The latest problem with that, is that FastMap was used to hold the list of components found. When things are inserted into a FastMap, iteration over the values maintains the order that they were added in. Switching to ConcurrentHashMap, or ConcurrentLinkedHashMap, gives things back in an effectively random order. My plan here is to add 'dependencies' to the component definitions. Then, if no dependencies are specified for a particular ofbiz-component.xml, it'll default to depending on all currently loaded components. I already have a dependency resolver written, to put the components in the proper order. This will also allow us to start encoding real dependency settings into ofbiz. I should have this all ready to go by sunday evening.
