Bug 522313 - Remove loop used to acquire the bundle id lock on bundle
installation

When installing a new module there is a loop in the Storage class which
repeatedly attempts to acquire the next module ID lock before installing
the module into the module container.

This has always been a sort of hack because it is attempting to lock the
next module ID outside of the module container so that we can stage the
bundle content correctly into the bundle id folder before installing the
module into the container.  To do that we needed to know what the next
module id is going to be and lock it so that no other thread attempts to
install over with the module ID we are trying to stage.

Instead of doing this strange locking loop this fix adds a new method to
the module container to get and increment the next module ID and then
passes that module ID in as part of the ModuleRevisionBuilder.  This way
if multiple threads are installing modules they each will get thier own
unique module ID without requiring any outside the container locking.

Change-Id: I215a991bb4ef2a71eea542259b32e0c9509d9c8f
Signed-off-by: Thomas Watson <tjwatson@us.ibm.com>
10 files changed