celix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pnol...@apache.org
Subject [32/38] celix git commit: CELIX-272: Add ifdef to check if cmake uses RELEASE build, in that case do not use deleted service reference check.
Date Tue, 17 Nov 2015 11:57:49 GMT
CELIX-272: Add ifdef to check if cmake uses RELEASE build, in that case do not use deleted
service reference check.


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

Branch: refs/heads/develop
Commit: 03da4ec92f9c96bd94f36b301637fdac4e3022fd
Parents: c641ae0
Author: Pepijn Noltes <pepijnnoltes@gmail.com>
Authored: Tue Nov 17 09:36:03 2015 +0100
Committer: Pepijn Noltes <pepijnnoltes@gmail.com>
Committed: Tue Nov 17 09:36:03 2015 +0100

----------------------------------------------------------------------
 framework/private/src/service_registry.c | 21 +++++++++++++++------
 1 file changed, 15 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/celix/blob/03da4ec9/framework/private/src/service_registry.c
----------------------------------------------------------------------
diff --git a/framework/private/src/service_registry.c b/framework/private/src/service_registry.c
index 28d22e0..277fe77 100644
--- a/framework/private/src/service_registry.c
+++ b/framework/private/src/service_registry.c
@@ -35,6 +35,12 @@
 #include "service_reference_private.h"
 #include "framework_private.h"
 
+#ifdef NDEBUG
+#define CHECK_DELETED_REFERENCES false
+#else
+#define CHECK_DELETED_REFERENCES true
+#endif
+
 celix_status_t serviceRegistry_registerServiceInternal(service_registry_pt registry, bundle_pt
bundle, char * serviceName, void * serviceObject, properties_pt dictionary, bool isFactory,
service_registration_pt *registration);
 celix_status_t serviceRegistry_addHooks(service_registry_pt registry, char *serviceName,
void *serviceObject, service_registration_pt registration);
 celix_status_t serviceRegistry_removeHook(service_registry_pt registry, service_registration_pt
registration);
@@ -67,7 +73,7 @@ celix_status_t serviceRegistry_create(framework_pt framework, serviceChanged_fun
 		reg->currentServiceId = 1l;
 		reg->serviceReferences = hashMap_create(NULL, NULL, NULL, NULL);
 
-        reg->checkDeletedReferences = true;
+        reg->checkDeletedReferences = CHECK_DELETED_REFERENCES;
         reg->deletedServiceReferences = hashMap_create(NULL, NULL, NULL, NULL);
 
 		arrayList_create(&reg->listenerHooks);
@@ -248,7 +254,7 @@ celix_status_t serviceRegistry_clearServiceRegistrations(service_registry_pt
reg
 static void serviceRegistry_logWarningServiceRegistration(service_registry_pt registry __attribute__((unused)),
service_registration_pt reg) {
     char *servName = NULL;
     serviceRegistration_getServiceName(reg, &servName);
-    fw_log(logger, OSGI_FRAMEWORK_LOG_WARNING, "Dangling service registration for service
%s. Look for missing serviceRegistration_unregister.", servName);
+    fw_log(logger, OSGI_FRAMEWORK_LOG_WARNING, "Dangling service registration for service
%s. Look for missing serviceRegistration_unregister calls.", servName);
 }
 
 celix_status_t serviceRegistry_getServiceReference(service_registry_pt registry, bundle_pt
owner,
@@ -427,8 +433,11 @@ celix_status_t serviceRegistry_setReferenceStatus(service_registry_pt
registry,
 static void serviceRegistry_logIllegalReference(service_registry_pt registry __attribute__((unused)),
service_reference_pt reference,
                                                    reference_status_t refStatus) {
 
-    fw_log(logger, OSGI_FRAMEWORK_LOG_ERROR, "Error handling service reference %p from registration
%p and bundle (owner) %p, ref has ref status %i",
-           reference, reference->registration, reference->referenceOwner, refStatus);
+    service_registration_pt reg = reference != NULL ? reference->registration : NULL;
+    bundle_pt bundle = reference != NULL ? reference->referenceOwner : NULL;
+    fw_log(logger, OSGI_FRAMEWORK_LOG_ERROR,
+           "Error handling service reference %p from registration %p and bundle (owner) %p,
ref has ref status %i",
+           reference, reg, bundle, refStatus);
 }
 
 celix_status_t serviceRegistry_checkReference(service_registry_pt registry, service_reference_pt
ref,
@@ -454,10 +463,10 @@ celix_status_t serviceRegistry_checkReference(service_registry_pt registry,
serv
 
 void serviceRegistry_logWarningServiceReferenceUsageCount(service_registry_pt registry __attribute__((unused)),
size_t usageCount, size_t refCount) {
     if (usageCount > 0) {
-        fw_log(logger, OSGI_FRAMEWORK_LOG_WARNING, "Service Reference destroyed will usage
count is %zu. Look for missing bundleContext_ungetService calls.", usageCount);
+        fw_log(logger, OSGI_FRAMEWORK_LOG_WARNING, "Service Reference destroyed with usage
count is %zu. Look for missing bundleContext_ungetService calls.", usageCount);
     }
     if (refCount > 0) {
-        fw_log(logger, OSGI_FRAMEWORK_LOG_WARNING, "Dangling service reference. Reference
count is %zu. Look for missing bundleContext_ungetServiceReference.", refCount);
+        fw_log(logger, OSGI_FRAMEWORK_LOG_WARNING, "Dangling service reference. Reference
count is %zu.  Look for missing bundleContext_ungetServiceReference calls.", refCount);
     }
 }
 


Mime
View raw message