This is an automated email from the ASF dual-hosted git repository.
pauls pushed a commit to branch connect
in repository https://gitbox.apache.org/repos/asf/felix-dev.git
The following commit(s) were added to refs/heads/connect by this push:
new 30a9f35 FELIX-6331: fix a race condtion in unget service from service
factory.
30a9f35 is described below
commit 30a9f354673ff5dead59b31f41997eb210027689
Author: Karl Pauls <[email protected]>
AuthorDate: Thu Sep 17 23:15:50 2020 +0200
FELIX-6331: fix a race condtion in unget service from service factory.
---
.../main/java/org/apache/felix/framework/ServiceRegistry.java | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git
a/framework/src/main/java/org/apache/felix/framework/ServiceRegistry.java
b/framework/src/main/java/org/apache/felix/framework/ServiceRegistry.java
index 8c94ca8..1522133 100644
--- a/framework/src/main/java/org/apache/felix/framework/ServiceRegistry.java
+++ b/framework/src/main/java/org/apache/felix/framework/ServiceRegistry.java
@@ -490,11 +490,11 @@ public class ServiceRegistry
if (svc != null)
{
- // Check the count again to ensure that nobody else
has just
- // obtained the service again
- if (usage.m_count.get() <= 0)
+ if (usage.m_svcHolderRef.compareAndSet(holder, null))
{
- if (usage.m_svcHolderRef.compareAndSet(holder,
null))
+ // Check the count again to ensure that nobody
else has just
+ // obtained the service again
+ if (usage.m_count.get() <= 0)
{
// Temporarily increase the usage again so
that the
// service factory still sees the usage in the
unget
@@ -509,7 +509,6 @@ public class ServiceRegistry
// now we can decrease the usage again
usage.m_count.decrementAndGet();
}
-
}
}
}