changeset 6975:0e6a65731bbc

use different thread names in the multitenant DicomServer
author Alain Mazy <am@orthanc.team>
date Thu, 02 Jul 2026 17:20:47 +0200
parents 58018d5883d1
children 5b8ee3b407b1
files OrthancFramework/Sources/DicomNetworking/DicomServer.cpp OrthancFramework/Sources/DicomNetworking/DicomServer.h OrthancServer/Plugins/Samples/MultitenantDicom/MultitenantDicomServer.cpp OrthancServer/Sources/main.cpp
diffstat 4 files changed, 13 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/OrthancFramework/Sources/DicomNetworking/DicomServer.cpp	Thu Jul 02 16:34:16 2026 +0200
+++ b/OrthancFramework/Sources/DicomNetworking/DicomServer.cpp	Thu Jul 02 17:20:47 2026 +0200
@@ -63,7 +63,7 @@
                                  unsigned int maximumPduLength,
                                  bool useDicomTls)
   {
-    Logging::ScopedThreadNameSetter setter("DICOM-SERVER");
+    Logging::ScopedThreadNameSetter setter(server->name_);
     CLOG(INFO, DICOM) << "DICOM server started";
 
     while (server->continue_)
@@ -90,12 +90,15 @@
   }
 
 
-  DicomServer::DicomServer() :
+  DicomServer::DicomServer(const std::string& name,
+                           const std::string& dicomThreadNamesPrefix) :
     pimpl_(new PImpl),
     checkCalledAet_(true),
     aet_("ANY-SCP"),
     port_(104),
     continue_(false),
+    name_(name),
+    dicomThreadNamesPrefix_(dicomThreadNamesPrefix),
     associationTimeout_(30),
     threadsCount_(4),
     modalities_(NULL),
@@ -436,11 +439,11 @@
 
     if (metricsRegistry_ == NULL)
     {
-      pimpl_->workers_.reset(new RunnableWorkersPool(threadsCount_, "DICOM-"));
+      pimpl_->workers_.reset(new RunnableWorkersPool(threadsCount_, dicomThreadNamesPrefix_ + "-"));
     }
     else
     {
-      pimpl_->workers_.reset(new RunnableWorkersPool(threadsCount_, "DICOM-", *metricsRegistry_, "orthanc_available_dicom_threads"));
+      pimpl_->workers_.reset(new RunnableWorkersPool(threadsCount_, dicomThreadNamesPrefix_ + "-", *metricsRegistry_, "orthanc_available_dicom_threads"));
     }
 
     pimpl_->thread_ = boost::thread(ServerThread, this, maximumPduLength_, useDicomTls_);
--- a/OrthancFramework/Sources/DicomNetworking/DicomServer.h	Thu Jul 02 16:34:16 2026 +0200
+++ b/OrthancFramework/Sources/DicomNetworking/DicomServer.h	Thu Jul 02 17:20:47 2026 +0200
@@ -75,6 +75,8 @@
     std::string aet_;
     uint16_t port_;
     bool continue_;
+    std::string name_;
+    std::string dicomThreadNamesPrefix_;
     uint32_t associationTimeout_;
     unsigned int threadsCount_;
     IRemoteModalities* modalities_;
@@ -102,7 +104,8 @@
                              bool useDicomTls);
 
   public:
-    DicomServer();
+    DicomServer(const std::string& name,
+                const std::string& dicomThreadNamesPrefix);
 
     ~DicomServer();
 
--- a/OrthancServer/Plugins/Samples/MultitenantDicom/MultitenantDicomServer.cpp	Thu Jul 02 16:34:16 2026 +0200
+++ b/OrthancServer/Plugins/Samples/MultitenantDicom/MultitenantDicomServer.cpp	Thu Jul 02 17:20:47 2026 +0200
@@ -93,7 +93,7 @@
     labelsStoreLevels_.insert(Orthanc::ResourceType_Instance);
   }
   
-  server_.reset(new Orthanc::DicomServer);
+  server_.reset(new Orthanc::DicomServer("MULTI-DCM-SERVER", "MULTI-DCM"));
 
   {
     OrthancPlugins::OrthancConfiguration globalConfig;
--- a/OrthancServer/Sources/main.cpp	Thu Jul 02 16:34:16 2026 +0200
+++ b/OrthancServer/Sources/main.cpp	Thu Jul 02 17:20:47 2026 +0200
@@ -1380,7 +1380,7 @@
     ModalitiesFromConfiguration modalities;
   
     // Setup the DICOM server  
-    DicomServer dicomServer;
+    DicomServer dicomServer("DICOM-SERVER", "DICOM-");
     dicomServer.SetMetricsRegistry(context.GetMetricsRegistry());
     dicomServer.SetRemoteModalities(modalities);
     dicomServer.SetStoreRequestHandlerFactory(serverFactory);