PengZheng commented on code in PR #414: URL: https://github.com/apache/celix/pull/414#discussion_r856888923
########## bundles/remote_services/topology_manager/src/topology_manager.c: ########## @@ -290,75 +264,70 @@ celix_status_t topologyManager_rsaRemoved(void * handle, service_reference_pt re topology_manager_pt manager = (topology_manager_pt) handle; remote_service_admin_service_t *rsa = (remote_service_admin_service_t *) service; - if (celixThreadMutex_lock(&manager->exportedServicesLock) == CELIX_SUCCESS) { - hash_map_iterator_pt iter = hashMapIterator_create(manager->exportedServices); + celixThreadMutex_lock(&manager->lock); - while (hashMapIterator_hasNext(iter)) { + hash_map_iterator_pt exportedSvcIter = hashMapIterator_create(manager->exportedServices); - hash_map_entry_pt entry = hashMapIterator_nextEntry(iter); - service_reference_pt key = hashMapEntry_getKey(entry); - hash_map_pt exports = hashMapEntry_getValue(entry); - - /* - * the problem here is that also the rsa has a a list of - * endpoints which is destroyed when closing the exportRegistration - */ - array_list_pt exports_list = hashMap_get(exports, rsa); - - if (exports_list != NULL) { - int exportsIter = 0; - int exportListSize = arrayList_size(exports_list); - for (exportsIter = 0; exports_list != NULL && exportsIter < exportListSize; exportsIter++) { - export_registration_t *export = arrayList_get(exports_list, exportsIter); - topologyManager_notifyListenersEndpointRemoved(manager, rsa, export); - rsa->exportRegistration_close(rsa->admin, export); - } - } + while (hashMapIterator_hasNext(exportedSvcIter)) { - hashMap_remove(exports, rsa); - /*if(exports_list!=NULL){ - arrayList_destroy(exports_list); - }*/ + hash_map_entry_pt entry = hashMapIterator_nextEntry(exportedSvcIter); + service_reference_pt key = hashMapEntry_getKey(entry); + hash_map_pt exports = hashMapEntry_getValue(entry); - if (hashMap_size(exports) == 0) { - hashMap_remove(manager->exportedServices, key); - hashMap_destroy(exports, false, false); + /* + * the problem here is that also the rsa has a a list of Review Comment: @pnoltes This is an old comment. Xu is thinking about improvement of this. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: dev-unsubscr...@celix.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org