celix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ejans...@apache.org
Subject celix git commit: CELIX-372: added information on warning origin
Date Thu, 04 Aug 2016 12:26:15 GMT
Repository: celix
Updated Branches:
  refs/heads/develop 7841ff75d -> 5f3a82539


CELIX-372: added information on warning origin


Project: http://git-wip-us.apache.org/repos/asf/celix/repo
Commit: http://git-wip-us.apache.org/repos/asf/celix/commit/5f3a8253
Tree: http://git-wip-us.apache.org/repos/asf/celix/tree/5f3a8253
Diff: http://git-wip-us.apache.org/repos/asf/celix/diff/5f3a8253

Branch: refs/heads/develop
Commit: 5f3a825392b84a3d53ac0de7ce3d5eb3c30d6b6e
Parents: 7841ff7
Author: Erik Jansman <ejansman@apache.org>
Authored: Thu Aug 4 14:25:47 2016 +0200
Committer: Erik Jansman <ejansman@apache.org>
Committed: Thu Aug 4 14:25:47 2016 +0200

----------------------------------------------------------------------
 framework/private/src/service_registry.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/celix/blob/5f3a8253/framework/private/src/service_registry.c
----------------------------------------------------------------------
diff --git a/framework/private/src/service_registry.c b/framework/private/src/service_registry.c
index c343c7c..a5dd20c 100644
--- a/framework/private/src/service_registry.c
+++ b/framework/private/src/service_registry.c
@@ -540,6 +540,7 @@ static void serviceRegistry_logWarningServiceReferenceUsageCount(service_registr
 celix_status_t serviceRegistry_clearReferencesFor(service_registry_pt registry, bundle_pt
bundle) {
     celix_status_t status = CELIX_SUCCESS;
 
+    int echoName =0;
     celixThreadRwlock_writeLock(&registry->lock);
 
     hash_map_pt refsMap = hashMap_remove(registry->serviceReferences, bundle);
@@ -552,6 +553,10 @@ celix_status_t serviceRegistry_clearReferencesFor(service_registry_pt
registry,
 
             serviceReference_getUsageCount(ref, &usageCount);
             serviceReference_getReferenceCount(ref, &refCount);
+            if(refCount>0)
+            {
+                echoName++;
+            }
 
             serviceRegistry_logWarningServiceReferenceUsageCount(registry, usageCount, refCount);
 
@@ -570,6 +575,15 @@ celix_status_t serviceRegistry_clearReferencesFor(service_registry_pt
registry,
         hashMap_destroy(refsMap, false, false);
     }
 
+    if(echoName >0)
+    {
+        module_pt module_ptr = NULL;
+        bundle_getCurrentModule(bundle, &module_ptr);
+        const char *name_str = NULL;
+        module_getSymbolicName(module_ptr, &name_str);
+        fw_log(logger, OSGI_FRAMEWORK_LOG_WARNING,"Previous Dangling service reference warnings
caused by bundle: %s",name_str);
+    }
+
     celixThreadRwlock_unlock(&registry->lock);
 
     return status;


Mime
View raw message