You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@celix.apache.org by pn...@apache.org on 2020/07/13 11:47:53 UTC

[celix] branch master updated: Make pstm handling thread sleep time configurable

This is an automated email from the ASF dual-hosted git repository.

pnoltes pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/celix.git


The following commit(s) were added to refs/heads/master by this push:
     new ee86303  Make pstm handling thread sleep time configurable
     new 23d6bce  Merge pull request #267 from Oipo/feature/configurable_sleeptime_pstm
ee86303 is described below

commit ee86303c4b8c7c3e134731ea5b4bcd51111bfac6
Author: Michael de Lang <ki...@gmail.com>
AuthorDate: Thu Jul 9 13:46:48 2020 +0200

    Make pstm handling thread sleep time configurable
---
 .../pubsub/pubsub_topology_manager/src/pubsub_topology_manager.c    | 5 +++--
 .../pubsub/pubsub_topology_manager/src/pubsub_topology_manager.h    | 2 ++
 bundles/pubsub/test/CMakeLists.txt                                  | 6 ------
 3 files changed, 5 insertions(+), 8 deletions(-)

diff --git a/bundles/pubsub/pubsub_topology_manager/src/pubsub_topology_manager.c b/bundles/pubsub/pubsub_topology_manager/src/pubsub_topology_manager.c
index 8397a67..4b4ad90 100644
--- a/bundles/pubsub/pubsub_topology_manager/src/pubsub_topology_manager.c
+++ b/bundles/pubsub/pubsub_topology_manager/src/pubsub_topology_manager.c
@@ -39,7 +39,7 @@
 #include "pubsub_admin.h"
 #include "../../pubsub_admin_udp_mc/src/pubsub_udpmc_topic_sender.h"
 
-#define PSTM_PSA_HANDLING_SLEEPTIME_IN_SECONDS       30L
+#define PSTM_PSA_HANDLING_DEFAULT_SLEEPTIME_IN_SECONDS       30L
 
 #ifndef UUID_STR_LEN
 #define UUID_STR_LEN    37
@@ -79,6 +79,7 @@ celix_status_t pubsub_topologyManager_create(celix_bundle_context_t *context, ce
 
     manager->loghelper = logHelper;
     manager->verbose = celix_bundleContext_getPropertyAsBool(context, PUBSUB_TOPOLOGY_MANAGER_VERBOSE_KEY, PUBSUB_TOPOLOGY_MANAGER_DEFAULT_VERBOSE);
+    manager->handlingThreadSleepTime = celix_bundleContext_getPropertyAsLong(context, PUBSUB_TOPOLOGY_MANAGER_HANDLING_THREAD_SLEEPTIME_SECONDS_KEY, PSTM_PSA_HANDLING_DEFAULT_SLEEPTIME_IN_SECONDS);
 
     manager->psaHandling.running = true;
     celixThread_create(&manager->psaHandling.thread, NULL, pstm_psaHandlingThread, manager);
@@ -1107,7 +1108,7 @@ static void *pstm_psaHandlingThread(void *data) {
         pstm_findPsaForEndpoints(manager); //trying to find psa and possible set for endpoints with no psa
 
         celixThreadMutex_lock(&manager->psaHandling.mutex);
-        celixThreadCondition_timedwaitRelative(&manager->psaHandling.cond, &manager->psaHandling.mutex, PSTM_PSA_HANDLING_SLEEPTIME_IN_SECONDS, 0L);
+        celixThreadCondition_timedwaitRelative(&manager->psaHandling.cond, &manager->psaHandling.mutex, manager->handlingThreadSleepTime, 0L);
         running = manager->psaHandling.running;
         celixThreadMutex_unlock(&manager->psaHandling.mutex);
     }
diff --git a/bundles/pubsub/pubsub_topology_manager/src/pubsub_topology_manager.h b/bundles/pubsub/pubsub_topology_manager/src/pubsub_topology_manager.h
index 9f5ef49..842d861 100644
--- a/bundles/pubsub/pubsub_topology_manager/src/pubsub_topology_manager.h
+++ b/bundles/pubsub/pubsub_topology_manager/src/pubsub_topology_manager.h
@@ -31,6 +31,7 @@
 #include "pubsub/subscriber.h"
 
 #define PUBSUB_TOPOLOGY_MANAGER_VERBOSE_KEY         "PUBSUB_TOPOLOGY_MANAGER_VERBOSE"
+#define PUBSUB_TOPOLOGY_MANAGER_HANDLING_THREAD_SLEEPTIME_SECONDS_KEY         "PUBSUB_TOPOLOGY_MANAGER_HANDLING_THREAD_SLEEPTIME_SECONDS"
 #define PUBSUB_TOPOLOGY_MANAGER_DEFAULT_VERBOSE     false
 
 
@@ -76,6 +77,7 @@ typedef struct pubsub_topology_manager {
 
     celix_log_helper_t *loghelper;
 
+    unsigned handlingThreadSleepTime;
     bool verbose;
 } pubsub_topology_manager_t;
 
diff --git a/bundles/pubsub/test/CMakeLists.txt b/bundles/pubsub/test/CMakeLists.txt
index 8b7e061..a78958a 100644
--- a/bundles/pubsub/test/CMakeLists.txt
+++ b/bundles/pubsub/test/CMakeLists.txt
@@ -173,12 +173,6 @@ if (BUILD_PUBSUB_PSA_UDP_MC)
     add_test(NAME pstm_deadlock_udpmc_test COMMAND pstm_deadlock_udpmc_test WORKING_DIRECTORY $<TARGET_PROPERTY:pstm_deadlock_udpmc_test,CONTAINER_LOC>)
     setup_target_for_coverage(pstm_deadlock_udpmc_test SCAN_DIR ..)
 
-    #TCP Endpoint test is disabled because the test is not stable when running on Travis
-    if (ENABLE_PUBSUB_PSA_TCP_ENDPOINT_TEST)
-        add_test(NAME pubsub_tcp_endpoint_tests COMMAND pubsub_tcp_endpoint_tests WORKING_DIRECTORY $<TARGET_PROPERTY:pubsub_tcp_endpoint_tests,CONTAINER_LOC>)
-        setup_target_for_coverage(pubsub_tcp_endpoint_tests SCAN_DIR ..)
-    endif()
-
     #TODO fix issues with UDPMC and reanble test again
     #add_test(NAME pubsub_udpmc_tests COMMAND pubsub_udpmc_tests WORKING_DIRECTORY $<TARGET_PROPERTY:pubsub_udpmc_tests,CONTAINER_LOC>)
     #setup_target_for_coverage(pubsub_udpmc_tests SCAN_DIR ..)