FELIX-4361 Applied the patch, including the suggestion from Sander Mak. Modified the existing test case to correctly terminate instead of waiting 30 seconds. Added a simpler test case that shows the problem without relying on multiple threads.

git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@1551928 13f79535-47bb-0310-9956-ffa450edef68