Bundle locks should be reentrant. (FELIX-2598)
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@999116 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/framework/src/main/java/org/apache/felix/framework/Felix.java b/framework/src/main/java/org/apache/felix/framework/Felix.java
index aa45768..1ec8304 100644
--- a/framework/src/main/java/org/apache/felix/framework/Felix.java
+++ b/framework/src/main/java/org/apache/felix/framework/Felix.java
@@ -4679,9 +4679,11 @@
{
// Wait if the desired bundle is already locked by someone else
// or if any thread has the global lock, unless the current thread
- // holds the global lock.
+ // holds the global lock or the bundle lock already.
while (!bundle.isLockable() ||
- ((m_globalLockThread != null) && (m_globalLockThread != Thread.currentThread())))
+ ((bundle.getLockingThread() != Thread.currentThread())
+ && (m_globalLockThread != null)
+ && (m_globalLockThread != Thread.currentThread())))
{
// Check to make sure the bundle is in a desired state.
// If so, keep waiting. If not, throw an exception.