void filter_destroy(filter_pt filter) { if (filter != NULL) { if(filter->value!=NULL){ if (filter->operand == SUBSTRING) { int size = arrayList_size(filter->value); for (; size > 0; --size) { char* operand = (char*) arrayList_remove(filter->value, 0); free(operand); } arrayList_destroy(filter->value); filter->value = NULL; } else if ( (filter->operand == OR) || (filter->operand == AND) ) { int size = arrayList_size(filter->value); unsigned int i = 0; for (i = 0; i < size; i++) { filter_pt f = arrayList_get(filter->value, i); filter_destroy(f); } arrayList_destroy(filter->value); filter->value = NULL; } else if (filter->operand == NOT) { filter_destroy(filter->value); filter->value = NULL; } else { free(filter->value); filter->value = NULL; } } free(filter->attribute); filter->attribute = NULL; free(filter); filter = NULL; } }
static void testProxyRemoval(void) { celix_status_t status; bundle_pt bundle = NULL; array_list_pt bundleNames = NULL; array_list_pt proxyBundle = NULL; service_reference_pt ref = NULL; arrayList_create(&bundleNames); arrayList_create(&proxyBundle); arrayList_add(bundleNames, (void*) CALCULATOR_PROXY); status = getSpecifiedBundles(clientContext, bundleNames, proxyBundle); CHECK_EQUAL(CELIX_SUCCESS, status); CHECK_EQUAL(arrayList_size(proxyBundle), arrayList_size(bundleNames)); status = bundleContext_getBundleById(clientContext, (long) arrayList_get(proxyBundle, 0), &bundle); CHECK_EQUAL(CELIX_SUCCESS, status); status = bundle_stop(bundle); CHECK_EQUAL(CELIX_SUCCESS, status); status = bundleContext_getServiceReference(clientContext, (char *) CALCULATOR_SERVICE, &ref); CHECK_EQUAL(CELIX_SUCCESS, status); CHECK(ref == NULL); arrayList_destroy(bundleNames); arrayList_destroy(proxyBundle); }
celix_status_t serviceRegistry_unregisterService(service_registry_pt registry, bundle_pt bundle, service_registration_pt registration) { // array_list_t clients; unsigned int i; array_list_pt regs; array_list_pt references = NULL; celixThreadMutex_lock(®istry->mutex); serviceRegistry_removeHook(registry, registration); regs = (array_list_pt) hashMap_get(registry->serviceRegistrations, bundle); if (regs != NULL) { arrayList_removeElement(regs, registration); hashMap_put(registry->serviceRegistrations, bundle, regs); } celixThreadMutex_unlock(®istry->mutex); if (registry->serviceChanged != NULL) { registry->serviceChanged(registry->framework, OSGI_FRAMEWORK_SERVICE_EVENT_UNREGISTERING, registration, NULL); } celixThreadMutex_lock(®istry->mutex); // unget service serviceRegistration_getServiceReferences(registration, &references); for (i = 0; i < arrayList_size(references); i++) { service_reference_pt reference = (service_reference_pt) arrayList_get(references, i); array_list_pt clients = NULL; unsigned int j; clients = serviceRegistry_getUsingBundles(registry, reference); for (j = 0; (clients != NULL) && (j < arrayList_size(clients)); j++) { bundle_pt client = (bundle_pt) arrayList_get(clients, j); bool ungetResult = true; while (ungetResult) { serviceRegistry_ungetService(registry, client, reference, &ungetResult); } } arrayList_destroy(clients); serviceReference_invalidate(reference); } arrayList_destroy(references); //TODO not needed, the registration is destroyed, any reference to the registration is invalid and will result in a segfault serviceRegistration_invalidate(registration); // serviceRegistration_destroy(registration); celixThreadMutex_unlock(®istry->mutex); return CELIX_SUCCESS; }
apr_status_t driverMatcher_destroy(void *matcherP) { driver_matcher_pt matcher = matcherP; arrayList_destroy(matcher->matches); hash_map_iterator_pt iter = hashMapIterator_create(matcher->attributes); while (hashMapIterator_hasNext(iter)) { array_list_pt list = hashMapIterator_nextValue(iter); if (list != NULL) { arrayList_destroy(list); } } hashMapIterator_destroy(iter); hashMap_destroy(matcher->attributes, false, false); return APR_SUCCESS; }
celix_status_t serviceTracker_open(service_tracker_pt tracker) { service_listener_pt listener; array_list_pt initial = NULL; celix_status_t status = CELIX_SUCCESS; listener = (service_listener_pt) malloc(sizeof(*listener)); status = bundleContext_getServiceReferences(tracker->context, NULL, tracker->filter, &initial); if (status == CELIX_SUCCESS) { service_reference_pt initial_reference; unsigned int i; listener->handle = tracker; listener->serviceChanged = (void *) serviceTracker_serviceChanged; status = bundleContext_addServiceListener(tracker->context, listener, tracker->filter); if (status == CELIX_SUCCESS) { tracker->listener = listener; for (i = 0; i < arrayList_size(initial); i++) { initial_reference = (service_reference_pt) arrayList_get(initial, i); serviceTracker_track(tracker, initial_reference, NULL); } arrayList_clear(initial); arrayList_destroy(initial); initial = NULL; } } framework_logIfError(logger, status, NULL, "Cannot open tracker"); return status; }
celix_status_t deviceManager_getIdleDevices(device_manager_pt manager, array_list_pt *idleDevices) { celix_status_t status = CELIX_SUCCESS; status = arrayList_create(idleDevices); if (status == CELIX_SUCCESS) { hash_map_iterator_pt iter = hashMapIterator_create(manager->devices); while (hashMapIterator_hasNext(iter)) { celix_status_t substatus = CELIX_SUCCESS; service_reference_pt ref = hashMapIterator_nextKey(iter); const char *bsn = NULL; module_pt module = NULL; bundle_pt bundle = NULL; substatus = serviceReference_getBundle(ref, &bundle); if (substatus == CELIX_SUCCESS) { substatus = bundle_getCurrentModule(bundle, &module); if (substatus == CELIX_SUCCESS) { substatus = module_getSymbolicName(module, &bsn); if (substatus == CELIX_SUCCESS) { logHelper_log(manager->loghelper, OSGI_LOGSERVICE_DEBUG, "DEVICE_MANAGER: Check idle device: %s", bsn); array_list_pt bundles = NULL; substatus = serviceReference_getUsingBundles(ref, &bundles); if (substatus == CELIX_SUCCESS) { bool inUse = false; int i; for (i = 0; i < arrayList_size(bundles); i++) { bundle_pt bundle = arrayList_get(bundles, i); bool isDriver; celix_status_t sstatus = deviceManager_isDriverBundle(manager, bundle, &isDriver); if (sstatus == CELIX_SUCCESS) { if (isDriver) { const char *bsn = NULL; module_pt module = NULL; bundle_getCurrentModule(bundle, &module); module_getSymbolicName(module, &bsn); logHelper_log(manager->loghelper, OSGI_LOGSERVICE_DEBUG, "DEVICE_MANAGER: Not idle, used by driver: %s", bsn); inUse = true; break; } } } if (!inUse) { arrayList_add(*idleDevices, ref); } } if(bundles!=NULL){ arrayList_destroy(bundles); } } } } } hashMapIterator_destroy(iter); } return status; }
celix_status_t dataStore_destroy(data_store_type* dataStore){ celix_status_t status = CELIX_SUCCESS; pthread_mutex_lock(&(dataStore->lock)); /* Empty the queue */ array_list_iterator_pt iter = arrayListIterator_create(dataStore->store); while (arrayListIterator_hasNext(iter)) { free(arrayListIterator_next(iter)); } arrayListIterator_destroy(iter); /* Destroy the queue */ arrayList_destroy(dataStore->store); dataStore->store = NULL; pthread_mutex_unlock(&(dataStore->lock)); pthread_mutex_destroy(&(dataStore->lock)); free(dataStore->utilizationStatsName); free(dataStore->name); free(dataStore); return status; }
celix_status_t deviceManager_isDriverBundle(device_manager_pt manager, bundle_pt bundle, bool *isDriver) { celix_status_t status = CELIX_SUCCESS; (*isDriver) = false; array_list_pt refs = NULL; status = bundle_getRegisteredServices(bundle, &refs); if (status == CELIX_SUCCESS) { if (refs != NULL) { int i; for (i = 0; i < arrayList_size(refs); i++) { celix_status_t substatus = CELIX_SUCCESS; service_reference_pt ref = arrayList_get(refs, i); service_registration_pt registration = NULL; substatus = serviceReference_getServiceRegistration(ref, ®istration); if (substatus == CELIX_SUCCESS) { properties_pt properties = NULL; substatus = serviceRegistration_getProperties(registration, &properties); if (substatus == CELIX_SUCCESS) { char *object = properties_get(properties, (char *) OSGI_FRAMEWORK_OBJECTCLASS); if (strcmp(object, "driver") == 0) { *isDriver = true; break; } } } } arrayList_destroy(refs); } } return status; }
/** * Removes an endpoint URL from the list of polled endpoints. */ celix_status_t endpointDiscoveryPoller_removeDiscoveryEndpoint(endpoint_discovery_poller_pt poller, char *url) { celix_status_t status = CELIX_SUCCESS; if (celixThreadMutex_lock(&poller->pollerLock) != CELIX_SUCCESS) { status = CELIX_BUNDLE_EXCEPTION; } else { hash_map_entry_pt entry = hashMap_getEntry(poller->entries, url); if (entry == NULL) { logHelper_log(*poller->loghelper, OSGI_LOGSERVICE_DEBUG, "ENDPOINT_POLLER: There was no entry found belonging to url %s - maybe already removed?", url); } else { char* origKey = hashMapEntry_getKey(entry); logHelper_log(*poller->loghelper, OSGI_LOGSERVICE_DEBUG, "ENDPOINT_POLLER: remove discovery endpoint with url %s", url); array_list_pt entries = hashMap_remove(poller->entries, url); for (unsigned int i = arrayList_size(entries); i > 0; i--) { endpoint_description_pt endpoint = arrayList_get(entries, i - 1); discovery_removeDiscoveredEndpoint(poller->discovery, endpoint); arrayList_remove(entries, i - 1); endpointDescription_destroy(endpoint); } if (entries != NULL) { arrayList_destroy(entries); } free(origKey); } status = celixThreadMutex_unlock(&poller->pollerLock); } return status; }
celix_status_t serviceRegistry_unregisterServices(service_registry_pt registry, bundle_pt bundle) { array_list_pt regs = NULL; unsigned int i; celixThreadMutex_lock(®istry->mutex); regs = (array_list_pt) hashMap_get(registry->serviceRegistrations, bundle); celixThreadMutex_unlock(®istry->mutex); for (i = 0; (regs != NULL) && i < arrayList_size(regs); i++) { service_registration_pt reg = arrayList_get(regs, i); if (serviceRegistration_isValid(reg)) { serviceRegistration_unregister(reg); } } if (regs != NULL && arrayList_isEmpty(regs)) { celixThreadMutex_lock(®istry->mutex); array_list_pt removed = hashMap_remove(registry->serviceRegistrations, bundle); celixThreadMutex_unlock(®istry->mutex); arrayList_destroy(removed); removed = NULL; } celixThreadMutex_lock(®istry->mutex); hashMap_remove(registry->serviceRegistrations, bundle); celixThreadMutex_unlock(®istry->mutex); return CELIX_SUCCESS; }
celix_status_t wiringAdmin_stop(wiring_admin_pt admin) { celix_status_t status = CELIX_SUCCESS; celixThreadMutex_lock(&admin->exportedWiringEndpointLock); // stop tracker hash_map_iterator_pt iter = hashMapIterator_create(admin->wiringReceiveTracker); while (hashMapIterator_hasNext(iter)) { service_tracker_pt wiringReceiveTracker = (service_tracker_pt) hashMapIterator_nextValue(iter); if (serviceTracker_close(wiringReceiveTracker) == CELIX_SUCCESS) { serviceTracker_destroy(wiringReceiveTracker); } } hashMapIterator_destroy(iter); hashMap_clear(admin->wiringReceiveTracker, false, false); wiringAdmin_stopWebserver(admin); iter = hashMapIterator_create(admin->wiringReceiveServices); while (hashMapIterator_hasNext(iter)) { array_list_pt wiringReceiveServiceList = hashMapIterator_nextValue(iter); arrayList_destroy(wiringReceiveServiceList); } hashMapIterator_destroy(iter); hashMap_clear(admin->wiringReceiveServices, false, false); celixThreadMutex_unlock(&admin->exportedWiringEndpointLock); return status; }
/// \TEST_CASE_ID{1} /// \TEST_CASE_TITLE{Test register scope service} /// \TEST_CASE_REQ{REQ-1} /// \TEST_CASE_DESC Checks if 3 bundles are installed after the framework setup static void testBundles(void) { printf("Begin: %s\n", __func__); array_list_pt bundles = NULL; int rc = bundleContext_getBundles(context, &bundles); CHECK_EQUAL(0, rc); CHECK_EQUAL(5, arrayList_size(bundles)); //framework, scopeService & calc & rsa /* int size = arrayList_size(bundles); int i; for (i = 0; i < size; i += 1) { bundle_pt bundle = NULL; module_pt module = NULL; char *name = NULL; bundle = (bundle_pt) arrayList_get(bundles, i); bundle_getCurrentModule(bundle, &module); module_getSymbolicName(module, &name); printf("got bundle with symbolic name '%s'", name); }*/ arrayList_destroy(bundles); printf("End: %s\n", __func__); }
celix_status_t serviceRegistry_ungetServiceReference(service_registry_pt registry, bundle_pt owner, service_reference_pt reference) { celix_status_t status = CELIX_SUCCESS; bool valid = false; serviceRefernce_isValid(reference, &valid); if (valid) { bool ungetResult = true; while (ungetResult) { serviceRegistry_ungetService(registry, owner, reference, &ungetResult); } } celixThreadMutex_lock(®istry->referencesMapMutex); array_list_pt references = hashMap_get(registry->serviceReferences, owner); if (references != NULL) { arrayList_removeElement(references, reference); serviceReference_destroy(&reference); if (arrayList_size(references) > 0) { hashMap_put(registry->serviceReferences, owner, references); } else { array_list_pt removed = hashMap_remove(registry->serviceReferences, owner); arrayList_destroy(removed); } } celixThreadMutex_unlock(®istry->referencesMapMutex); return status; }
int main() { endpoint_descriptor_writer_pt writer = NULL; endpointDescriptorWriter_create(&writer); array_list_pt list = NULL; arrayList_create(&list); properties_pt props = properties_create(); properties_set(props, "objectClass", "com.acme.Foo"); properties_set(props, "endpoint.service.id", "3"); properties_set(props, "endpoint.id", "abcdefghijklmnopqrstuvwxyz"); properties_set(props, "endpoint.framework.uuid", "2983D849-93B1-4C2C-AC6D-5BCDA93ACB96"); endpoint_description_pt epd = NULL; endpointDescription_create(props, &epd); arrayList_add(list, epd); properties_pt props2 = properties_create(); properties_set(props2, "objectClass", "com.acme.Bar"); properties_set(props, "endpoint.service.id", "4"); properties_set(props, "endpoint.id", "abcdefghijklmnopqrstuvwxyz"); properties_set(props, "endpoint.framework.uuid", "2983D849-93B1-4C2C-AC6D-5BCDA93ACB96"); endpoint_description_pt epd2 = NULL; endpointDescription_create(props2, &epd2); arrayList_add(list, epd2); char *buffer = NULL; endpointDescriptorWriter_writeDocument(writer, list, &buffer); arrayList_destroy(list); endpointDescription_destroy(epd); endpointDescription_destroy(epd2); endpointDescriptorWriter_destroy(writer); printf("%s\n", buffer); }
void serviceRegistry_ungetServices(service_registry_pt registry, bundle_pt bundle) { array_list_pt fusages; array_list_pt usages; unsigned int i; celixThreadMutex_lock(®istry->mutex); usages = hashMap_get(registry->inUseMap, bundle); celixThreadMutex_unlock(®istry->mutex); if (usages == NULL || arrayList_isEmpty(usages)) { return; } // usage arrays? fusages = arrayList_clone(usages); for (i = 0; i < arrayList_size(fusages); i++) { usage_count_pt usage = arrayList_get(fusages, i); service_reference_pt reference = usage->reference; bool ungetResult = true; while (ungetResult) { serviceRegistry_ungetService(registry, bundle, reference, &ungetResult); } } arrayList_destroy(fusages); }
celix_status_t remoteServiceAdmin_stop(remote_service_admin_pt admin) { celix_status_t status = CELIX_SUCCESS; celixThreadMutex_lock(&admin->exportedServicesLock); 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); if (export != NULL) { exportRegistration_stop(export); exportRegistration_destroy(export); } } arrayList_destroy(exports); } hashMapIterator_destroy(iter); celixThreadMutex_unlock(&admin->exportedServicesLock); celixThreadMutex_lock(&admin->importedServicesLock); int i; int size = arrayList_size(admin->importedServices); for (i = 0; i < size ; i += 1) { import_registration_pt import = arrayList_get(admin->importedServices, i); if (import != NULL) { importRegistration_stop(import); importRegistration_destroy(import); } } celixThreadMutex_unlock(&admin->importedServicesLock); if (admin->ctx != NULL) { logHelper_log(admin->loghelper, OSGI_LOGSERVICE_INFO, "RSA: Stopping webserver..."); mg_stop(admin->ctx); admin->ctx = NULL; } hashMap_destroy(admin->exportedServices, false, false); arrayList_destroy(admin->importedServices); logHelper_stop(admin->loghelper); logHelper_destroy(&admin->loghelper); return status; }
static void testExport(void) { celix_status_t status; array_list_pt bundleNames = NULL; array_list_pt bundlePermutations = NULL; array_list_pt rsaBundles = NULL; unsigned int i, size; arrayList_create(&bundleNames); arrayList_create(&bundlePermutations); arrayList_create(&rsaBundles); arrayList_add(bundleNames, (void*) DISCOVERY_CFG_NAME); arrayList_add(bundleNames, (void*) RSA_HTTP_NAME); arrayList_add(bundleNames, (void*) TOPOLOGY_MANAGER_NAME); status = getSpecifiedBundles(serverContext, bundleNames, rsaBundles); CHECK_EQUAL(CELIX_SUCCESS, status); CHECK_EQUAL(arrayList_size(rsaBundles), arrayList_size(bundleNames)); status = getPermutations(rsaBundles, 0, arrayList_size(rsaBundles) - 1, bundlePermutations); CHECK_EQUAL(CELIX_SUCCESS, status); size = arrayList_size(bundlePermutations); for (i = 0; i < size; ++i) { long* singlePermutation = (long*) arrayList_get(bundlePermutations, i); status = stopStartPermutation(serverContext, singlePermutation, arrayList_size(rsaBundles)); CHECK_EQUAL(CELIX_SUCCESS, status); /* we need to sleep here for a bit to ensure * that the client has flushed the old discovery * values */ sleep(2); // check whether calc service is available test1(); free(singlePermutation); } arrayList_destroy(bundlePermutations); arrayList_destroy(bundleNames); arrayList_destroy(rsaBundles); }
celix_status_t deviceManager_driverRemoved(void * handle, service_reference_pt ref, void * service) { celix_status_t status = CELIX_SUCCESS; device_manager_pt manager = handle; logHelper_log(manager->loghelper, OSGI_LOGSERVICE_DEBUG, "DEVICE_MANAGER: Remove driver"); hashMap_remove(manager->drivers, ref); array_list_pt idleDevices = NULL; status = deviceManager_getIdleDevices(manager, &idleDevices); if (status == CELIX_SUCCESS) { int i; for (i = 0; i < arrayList_size(idleDevices); i++) { celix_status_t forStatus = CELIX_SUCCESS; service_reference_pt ref = arrayList_get(idleDevices, i); const char *bsn = NULL; bundle_pt bundle = NULL; forStatus = serviceReference_getBundle(ref, &bundle); if (forStatus == CELIX_SUCCESS) { module_pt module = NULL; forStatus = bundle_getCurrentModule(bundle, &module); if (forStatus == CELIX_SUCCESS) { forStatus = module_getSymbolicName(module, &bsn); if (forStatus == CELIX_SUCCESS) { logHelper_log(manager->loghelper, OSGI_LOGSERVICE_DEBUG, "DEVICE_MANAGER: IDLE: %s", bsn); // #TODO attachDriver (idle device) // #TODO this can result in a loop? // Locate and install a driver // Let the match fail, the device is idle // The driver is removed, idle check is performed // Attach is tried again // .. loop .. void *device = hashMap_get(manager->devices, ref); forStatus = deviceManager_attachAlgorithm(manager, ref, device); } } } if (forStatus != CELIX_SUCCESS) { break; //Got error, stop loop and return status } } hash_map_iterator_pt iter = hashMapIterator_create(manager->drivers); while (hashMapIterator_hasNext(iter)) { hashMapIterator_nextValue(iter); // driver_attributes_pt da = hashMapIterator_nextValue(iter); // driverAttributes_tryUninstall(da); } hashMapIterator_destroy(iter); } if (idleDevices != NULL) { arrayList_destroy(idleDevices); } return status; }
static celix_status_t getSpecifiedBundles(bundle_context_pt context, array_list_pt bundleNames, array_list_pt retrievedBundles) { celix_status_t status; array_list_pt bundles = NULL; status = bundleContext_getBundles(context, &bundles); if (status == CELIX_SUCCESS) { unsigned int size = arrayList_size(bundles); unsigned int i; for (i = 0; i < size; i++) { module_pt module = NULL; const char *name = NULL; bundle_pt bundle = (bundle_pt) arrayList_get(bundles, i); status = bundle_getCurrentModule(bundle, &module); if (status == CELIX_SUCCESS) { status = module_getSymbolicName(module, &name); } if (status == CELIX_SUCCESS) { printf("FOUND %s\n", name); array_list_iterator_pt iter = arrayListIterator_create(bundleNames); while(arrayListIterator_hasNext(iter)) { char* bundleName = (char*) arrayListIterator_next(iter); if ((strcmp(name, bundleName) == 0)) { bundle_archive_pt bundleArchive = NULL; long bundleId = -1; status = bundle_getArchive(bundle, &bundleArchive); if (status == CELIX_SUCCESS) { status = bundleArchive_getId(bundleArchive, &bundleId); } if (status == CELIX_SUCCESS) { arrayList_add(retrievedBundles, (void*) bundleId); break; } } } arrayListIterator_destroy(iter); } } arrayList_destroy(bundles); } return status; }
celix_status_t bundleRevision_destroy(bundle_revision_pt revision) { arrayList_destroy(revision->libraryHandles); manifest_destroy(revision->manifest); free(revision->root); free(revision->location); free(revision); return CELIX_SUCCESS; }
void dm_destroy(void * userData, bundle_context_pt context, dependency_manager_pt manager) { struct data * data = (struct data *) userData; dependencyManager_remove(manager, data->service); arrayList_destroy(data->publishers); data->publishers = NULL; free(data); data = NULL; }
celix_status_t dm_destroy(void * userData, bundle_context_pt context, dm_dependency_manager_pt manager) { struct data * data = (struct data *) userData; arrayList_destroy(data->publishers); data->publishers = NULL; free(data); data = NULL; return CELIX_SUCCESS; }
celix_status_t refiningDriver_destroy(refining_driver_pt driver) { if (driver != NULL) { if (driver->devices != NULL) { arrayList_destroy(driver->devices); driver->devices=NULL; } } return CELIX_SUCCESS; }
celix_status_t deviceManager_destroy(device_manager_pt manager) { celix_status_t status = CELIX_SUCCESS; printf("DEVICE_MANAGER: Stop\n"); hashMap_destroy(manager->devices, false, false); hashMap_destroy(manager->drivers, false, false); arrayList_destroy(manager->locators); return status; }
celix_status_t driverMatcher_destroy(driver_matcher_pt *matcher) { arrayList_destroy((*matcher)->matches); hash_map_iterator_pt iter = hashMapIterator_create((*matcher)->attributes); while (hashMapIterator_hasNext(iter)) { array_list_pt list = hashMapIterator_nextValue(iter); if (list != NULL) { arrayList_destroy(list); } } hashMapIterator_destroy(iter); hashMap_destroy((*matcher)->attributes, false, false); logHelper_stop((*matcher)->loghelper); logHelper_destroy(&(*matcher)->loghelper); free(*matcher); return CELIX_SUCCESS; }
celix_status_t remoteShell_destroy(remote_shell_pt instance) { celix_status_t status = CELIX_SUCCESS; remoteShell_stopConnections(instance); celixThreadMutex_lock(&instance->mutex); arrayList_destroy(instance->connections); celixThreadMutex_unlock(&instance->mutex); return status; }
celix_status_t bundleActivator_destroy(void * userData, bundle_context_pt context) { struct disc_mock_activator *act = userData; if (act != NULL) { discMockService_destroy(act->serv); free(act->endpointListener); arrayList_destroy(act->endpointList); free(act); } return CELIX_SUCCESS; }
celix_status_t deviceManager_destroy(device_manager_pt manager) { celix_status_t status = CELIX_SUCCESS; logHelper_log(manager->loghelper, OSGI_LOGSERVICE_INFO, "DEVICE_MANAGER: Stop"); hashMap_destroy(manager->devices, false, false); hashMap_destroy(manager->drivers, false, false); arrayList_destroy(manager->locators); return status; }
celix_status_t pubsub_topicSubscriptionDestroy(topic_subscription_pt ts){ celix_status_t status = CELIX_SUCCESS; celixThreadMutex_lock(&ts->ts_lock); ts->running = false; free(ts->ifIpAddress); serviceTracker_destroy(ts->tracker); arrayList_clear(ts->sub_ep_list); arrayList_destroy(ts->sub_ep_list); hashMap_destroy(ts->servicesMap,false,false); celixThreadMutex_lock(&ts->socketMap_lock); hashMap_destroy(ts->socketMap,true,true); celixThreadMutex_unlock(&ts->socketMap_lock); celixThreadMutex_destroy(&ts->socketMap_lock); celixThreadMutex_lock(&ts->pendingConnections_lock); arrayList_destroy(ts->pendingConnections); celixThreadMutex_unlock(&ts->pendingConnections_lock); celixThreadMutex_destroy(&ts->pendingConnections_lock); celixThreadMutex_lock(&ts->pendingDisconnections_lock); arrayList_destroy(ts->pendingDisconnections); celixThreadMutex_unlock(&ts->pendingDisconnections_lock); celixThreadMutex_destroy(&ts->pendingDisconnections_lock); largeUdp_destroy(ts->largeUdpHandle); #if defined(__APPLE__) && defined(__MACH__) //TODO: Use kqueue for OSX #else close(ts->topicEpollFd); #endif celixThreadMutex_unlock(&ts->ts_lock); celixThreadMutex_destroy(&ts->ts_lock); free(ts); return status; }
void dependencyManager_destroyInfo(dm_dependency_manager_pt manager, dm_dependency_manager_info_pt info) { unsigned int i = 0; for(;i<arrayList_size(info->components);i++){ dm_component_info_pt cmpinfo = (dm_component_info_pt)arrayList_get(info->components,0); component_destroyComponentInfo(cmpinfo); } arrayList_destroy(info->components); free(info); }