Community
Participate
Working Groups
The current implementation continues with the current resolve process if a hook factory participating in the resolve process is unregistered or if a hook instance throws an exception. In both cases the resolve process should fail and if possible an exception must be thrown to the caller which triggered the resolve process. If the caller is not available then a framework event error must be fired.
Created attachment 188092 [details] patch and test changes In order to implement this in a reasonable way I had to simplify the way we select singletons. Previously we used a two pass resolver algorithm. In the first pass we would treat all bundles as non-singleton and get a reference count to all singleton bundles. Then we would try to select the version of each singleton that contained the highest reference count. The idea was that this version would allow more bundles to resolve. Then we would unresolve the unselected singletons from the first pass and start a second pass to resolve the bundles again. The problem with this approach is that it uses the State to record interim decisions between the first pass and the second pass. So if a hook throws an exception during the second pass then the State would be left in a weird state with the interim decisions about what bundles are resolved. This patch ensures that we do not record any resolution data until the end after the final resolution decisions have been made. This way if a hook throws an exception then the state is still intact and has not been changed. I had to add a new ResolverHookException so I could throw this from the resolver to the state and then report the error in the StateDelta. This was necessary because the State resolver process actually has two parts. 1) to unresolve a graph of bundles 2) to attempt to resolve the set of unresolved bundles in the state. ResolverHooks only participate in the second part. We need to always have a StateDelta even when a hook fails so that we can correctly reflect the unresolved bundles from step 1 in the framework. I had to update the testcases to reflect the different singleton selection algorithm.
Created attachment 188094 [details] patch and test changes previous patch contained extra changes to BundleHost unrelated to this fix.
patch released.