Exemple #1
0
celix_status_t discovery_destroy(discovery_pt discovery) {
	celix_status_t status = CELIX_SUCCESS;

	discovery->context = NULL;
	discovery->poller = NULL;
	discovery->server = NULL;

	celixThreadMutex_lock(&discovery->discoveredServicesMutex);

	hashMap_destroy(discovery->discoveredServices, false, false);
	discovery->discoveredServices = NULL;

	celixThreadMutex_unlock(&discovery->discoveredServicesMutex);

	celixThreadMutex_destroy(&discovery->discoveredServicesMutex);

	celixThreadMutex_lock(&discovery->listenerReferencesMutex);

	hashMap_destroy(discovery->listenerReferences, false, false);
	discovery->listenerReferences = NULL;

	celixThreadMutex_unlock(&discovery->listenerReferencesMutex);

	celixThreadMutex_destroy(&discovery->listenerReferencesMutex);

	logHelper_destroy(&discovery->loghelper);

	free(discovery);

	return status;
}
celix_status_t bundleActivator_destroy(void * userData, bundle_context_pt context) {
    celix_status_t status = CELIX_SUCCESS;
    struct activator * data =  userData;

    status = logHelper_destroy(&data->loghelper);

    return status;
}
celix_status_t eventPublisherStop(event_publisher_pt *event_publisher) {
	(*event_publisher)->running = false;
	apr_status_t status;
	apr_thread_join(&status,(*event_publisher)->sender);
	logHelper_stop((*event_publisher)->loghelper);
	logHelper_destroy(&(*event_publisher)->loghelper);
	return CELIX_SUCCESS;
}
Exemple #4
0
celix_status_t bundleActivator_destroy(void * userData, bundle_context_pt context) {
	celix_status_t status = CELIX_SUCCESS;
	bundle_instance_pt bi = (bundle_instance_pt) userData;

	connectionListener_destroy(bi->connectionListener);
	status = logHelper_destroy(&bi->loghelper);

	return status;
}
Exemple #5
0
celix_status_t shellMediator_destroy(shell_mediator_pt instance) {
	celix_status_t status = CELIX_SUCCESS;

	celixThreadMutex_lock(&instance->mutex);

	instance->shellService = NULL;
	serviceTracker_close(instance->tracker);
	celixThreadMutex_unlock(&instance->mutex);

	logHelper_stop(instance->loghelper);

	status = logHelper_destroy(&instance->loghelper);

	return status;
}
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;
}
Exemple #7
0
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;
}
Exemple #8
0
celix_status_t bundleActivator_destroy(void * userData, bundle_context_pt context) {
    celix_status_t status = CELIX_SUCCESS;

    struct activator *activator = userData;
    if (!activator || !activator->manager) {
        status = CELIX_BUNDLE_EXCEPTION;
    } else {
        logHelper_stop(activator->loghelper);
        logHelper_destroy(&activator->loghelper);

        status = topologyManager_destroy(activator->manager);

        if (activator->scopeService) {
        	free(activator->scopeService);
        }

        free(activator);
    }

    return status;
}
Exemple #9
0
celix_status_t pubsubAdmin_destroy(pubsub_admin_pt admin)
{
	celix_status_t status = CELIX_SUCCESS;

	free(admin->ipAddress);

	celixThreadMutex_lock(&admin->pendingSubscriptionsLock);
	hash_map_iterator_pt iter = hashMapIterator_create(admin->pendingSubscriptions);
	while(hashMapIterator_hasNext(iter)){
		hash_map_entry_pt entry = hashMapIterator_nextEntry(iter);
		free((char*)hashMapEntry_getKey(entry));
		arrayList_destroy((array_list_pt)hashMapEntry_getValue(entry));
	}
	hashMapIterator_destroy(iter);
	hashMap_destroy(admin->pendingSubscriptions,false,false);
	celixThreadMutex_unlock(&admin->pendingSubscriptionsLock);

	celixThreadMutex_lock(&admin->subscriptionsLock);
	hashMap_destroy(admin->subscriptions,false,false);
	celixThreadMutex_unlock(&admin->subscriptionsLock);

	celixThreadMutex_lock(&admin->localPublicationsLock);
	hashMap_destroy(admin->localPublications,true,false);
	celixThreadMutex_unlock(&admin->localPublicationsLock);

	celixThreadMutex_lock(&admin->externalPublicationsLock);
	iter = hashMapIterator_create(admin->externalPublications);
	while(hashMapIterator_hasNext(iter)){
		hash_map_entry_pt entry = hashMapIterator_nextEntry(iter);
		free((char*)hashMapEntry_getKey(entry));
		arrayList_destroy((array_list_pt)hashMapEntry_getValue(entry));
	}
	hashMapIterator_destroy(iter);
	hashMap_destroy(admin->externalPublications,false,false);
	celixThreadMutex_unlock(&admin->externalPublicationsLock);

	celixThreadMutex_lock(&admin->serializerListLock);
	arrayList_destroy(admin->serializerList);
	celixThreadMutex_unlock(&admin->serializerListLock);

	celixThreadMutex_lock(&admin->noSerializerPendingsLock);
	arrayList_destroy(admin->noSerializerSubscriptions);
	arrayList_destroy(admin->noSerializerPublications);
	celixThreadMutex_unlock(&admin->noSerializerPendingsLock);


	celixThreadMutex_lock(&admin->usedSerializersLock);

	iter = hashMapIterator_create(admin->topicSubscriptionsPerSerializer);
	while(hashMapIterator_hasNext(iter)){
		arrayList_destroy((array_list_pt)hashMapIterator_nextValue(iter));
	}
	hashMapIterator_destroy(iter);
	hashMap_destroy(admin->topicSubscriptionsPerSerializer,false,false);

	iter = hashMapIterator_create(admin->topicPublicationsPerSerializer);
	while(hashMapIterator_hasNext(iter)){
		arrayList_destroy((array_list_pt)hashMapIterator_nextValue(iter));
	}
	hashMapIterator_destroy(iter);
	hashMap_destroy(admin->topicPublicationsPerSerializer,false,false);

	celixThreadMutex_unlock(&admin->usedSerializersLock);

	celixThreadMutex_destroy(&admin->usedSerializersLock);
	celixThreadMutex_destroy(&admin->serializerListLock);
	celixThreadMutex_destroy(&admin->pendingSubscriptionsLock);

	celixThreadMutexAttr_destroy(&admin->noSerializerPendingsAttr);
	celixThreadMutex_destroy(&admin->noSerializerPendingsLock);

	celixThreadMutexAttr_destroy(&admin->pendingSubscriptionsAttr);
	celixThreadMutex_destroy(&admin->subscriptionsLock);

	celixThreadMutex_destroy(&admin->localPublicationsLock);
	celixThreadMutex_destroy(&admin->externalPublicationsLock);

	logHelper_stop(admin->loghelper);

	logHelper_destroy(&admin->loghelper);

#ifdef BUILD_WITH_ZMQ_SECURITY
	if (admin->zmq_auth != NULL){
		zactor_destroy(&(admin->zmq_auth));
	}
#endif

	free(admin);

	return status;
}