celix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pnol...@apache.org
Subject [08/16] celix git commit: CELIX-240: copy export_registrations to dedicated list to prevent deadlock during shutdown
Date Sat, 04 Jul 2015 11:21:00 GMT
CELIX-240: copy export_registrations to dedicated list to prevent deadlock during shutdown


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

Branch: refs/heads/feature/CELIX-237_rsa-ffi
Commit: cabd41a75321afb27b20664250a5fc6cccf9dec6
Parents: bdf8e06
Author: Bjoern Petri <bpetri@apache.org>
Authored: Sat Jun 20 16:03:14 2015 +0200
Committer: Bjoern Petri <bpetri@apache.org>
Committed: Sat Jun 20 16:03:14 2015 +0200

----------------------------------------------------------------------
 .../private/src/remote_service_admin_activator.c    |  3 ++-
 .../private/src/remote_service_admin_impl.c         | 16 +++++++++++++++-
 2 files changed, 17 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/celix/blob/cabd41a7/remote_services/remote_service_admin_http/private/src/remote_service_admin_activator.c
----------------------------------------------------------------------
diff --git a/remote_services/remote_service_admin_http/private/src/remote_service_admin_activator.c
b/remote_services/remote_service_admin_http/private/src/remote_service_admin_activator.c
index e4125fc..1b4c59c 100644
--- a/remote_services/remote_service_admin_http/private/src/remote_service_admin_activator.c
+++ b/remote_services/remote_service_admin_http/private/src/remote_service_admin_activator.c
@@ -99,10 +99,11 @@ celix_status_t bundleActivator_stop(void * userData, bundle_context_pt
context)
     celix_status_t status = CELIX_SUCCESS;
     struct activator *activator = userData;
 
-    remoteServiceAdmin_stop(activator->admin);
     serviceRegistration_unregister(activator->registration);
     activator->registration = NULL;
 
+    remoteServiceAdmin_stop(activator->admin);
+
     remoteServiceAdmin_destroy(&activator->admin);
 
     free(activator->adminService);

http://git-wip-us.apache.org/repos/asf/celix/blob/cabd41a7/remote_services/remote_service_admin_http/private/src/remote_service_admin_impl.c
----------------------------------------------------------------------
diff --git a/remote_services/remote_service_admin_http/private/src/remote_service_admin_impl.c
b/remote_services/remote_service_admin_http/private/src/remote_service_admin_impl.c
index 63e5192..319c849 100644
--- a/remote_services/remote_service_admin_http/private/src/remote_service_admin_impl.c
+++ b/remote_services/remote_service_admin_http/private/src/remote_service_admin_impl.c
@@ -207,18 +207,32 @@ celix_status_t remoteServiceAdmin_stop(remote_service_admin_pt admin)
{
 
     celixThreadMutex_lock(&admin->exportedServicesLock);
 
+    array_list_pt exportRegistrationList = NULL;
+
+    arrayList_create(&exportRegistrationList);
+
 	hash_map_iterator_pt iter = hashMapIterator_create(admin->exportedServices);
 	while (hashMapIterator_hasNext(iter)) {
 		array_list_pt exports = hashMapIterator_nextValue(iter);
 		int i;
+
 		for (i = 0; i < arrayList_size(exports); i++) {
 			export_registration_pt export = arrayList_get(exports, i);
-			exportRegistration_stopTracking(export);
+			arrayList_add(exportRegistrationList, export);
 		}
 	}
     hashMapIterator_destroy(iter);
     celixThreadMutex_unlock(&admin->exportedServicesLock);
 
+	int i;
+
+	for (i = 0; i < arrayList_size(exportRegistrationList); i++) {
+		export_registration_pt export = arrayList_get(exportRegistrationList, i);
+		exportRegistration_stopTracking(export);
+	}
+
+	arrayList_destroy(exportRegistrationList);
+
     celixThreadMutex_lock(&admin->importedServicesLock);
 
     iter = hashMapIterator_create(admin->importedServices);


Mime
View raw message