tjwatson opened a new pull request #47: URL: https://github.com/apache/felix-dev/pull/47
The tryInvokeBind method needs more safeguards around when the reference that just got bound is detected that it got removed. The previous code always assumed there was at least one other viable reference to bind to. That causes the NoSuchElementException when trying to find a fallback reference. Fixing that exposed another issue with the previous code where the state of the DependencyManager is not properly restored in two aspects: 1) Even when unbind is not invoked during tryInvokeBind the currentRefPair would get set to null when it must remain set to the previous value in cases where the invoke bind fails. A check is needed to be sure to only clear the currentRefPair if unbind was successfully invoked. 2) After invoking bind/unbind there is a check to see if the reference is still viable (not deleted). This is where the reported problem occurs when there is no alternative reference available and a NoSuchElementException is thrown. Avoiding the NoSuchElementException and returning from tryInvokeBind would leave the DependencyManager in a state where it thinks there is still a binding thread doing work when that thread is really done. Additional checks are needed to ensure we always restore the binding thread state of the DepenencyManager on exit of tryInvokeBind method. ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected]
