New branch 'bug/991149' available with the following commits:
commit 2900e5d4f4f5a765b6aff174f9e67206a9f4d060
Author: Elias Ross <genman(a)noderunner.net>
Date: Thu Nov 21 15:45:20 2013 +0100
Bug 991149 - Refactor Plugin Container Services initialization
Since there have been other race conditions in the past (as documented in the
code in a few spots), it feels there is an overall design issue at fault:
Objects are initialized in arbitrary order, enforced by the use of
'listeners',
but this was done as a reaction to what bugs were found.
The solution employed here is to use constructors and immutability when
possible. Handles to other components should be done using object fields, not
an object registry/singleton pattern. I tried to eliminate the use of
PluginContainer.getInstance().getXXX(), since in many cases references could be
null depending on the order of how objects are initialized. It also makes clear
what objects really depend on what objects. The use of 'PC.getInstance()'
should probably be entirely removed, since it's bug-prone, but I'll leave
the
rest of the cleanup for later.
Testability is generally improved, as test/mock instances can simply be
'injected' using the constructor, not by having to create methods
that get overridden.
Show replies by date