# HG changeset patch # User Sebastien Jodogne # Date 1782741780 -7200 # Node ID edd68dfbdd98961db5d1c4394e9a6f14b7444f9f # Parent d28c3fb90bd6b6d9900e8515ce6ad26e38d196dc removed IExecutorService::GetCountThreads() to stick with Java SDK diff -r d28c3fb90bd6 -r edd68dfbdd98 OrthancFramework/Sources/DataSource/DataSourceReader.cpp --- a/OrthancFramework/Sources/DataSource/DataSourceReader.cpp Mon Jun 29 15:47:19 2026 +0200 +++ b/OrthancFramework/Sources/DataSource/DataSourceReader.cpp Mon Jun 29 16:03:00 2026 +0200 @@ -323,10 +323,6 @@ return maximumMemory; } - unsigned int DataSourceReader::GetThreadsCount() const - { - return executor_->GetCountThreads(); - } boost::shared_ptr DataSourceReader::Submit(DataSourceRequest* request /* takes ownership */) { diff -r d28c3fb90bd6 -r edd68dfbdd98 OrthancFramework/Sources/DataSource/DataSourceReader.h --- a/OrthancFramework/Sources/DataSource/DataSourceReader.h Mon Jun 29 15:47:19 2026 +0200 +++ b/OrthancFramework/Sources/DataSource/DataSourceReader.h Mon Jun 29 16:03:00 2026 +0200 @@ -98,6 +98,11 @@ ~DataSourceReader(); + const boost::shared_ptr& GetExecutorService() const + { + return executor_; + } + void SetMetricsConfiguration(const MetricsConfiguration& configuration); void CreateCache(size_t capacity); @@ -110,7 +115,6 @@ uint64_t GetCapacity() const; - unsigned int GetThreadsCount() const; /** * Request the data source to load a set of items. The values will * be read in parallel by a thread pool (cf. "executor_") and will diff -r d28c3fb90bd6 -r edd68dfbdd98 OrthancFramework/Sources/MultiThreading/IExecutorService.h --- a/OrthancFramework/Sources/MultiThreading/IExecutorService.h Mon Jun 29 15:47:19 2026 +0200 +++ b/OrthancFramework/Sources/MultiThreading/IExecutorService.h Mon Jun 29 16:03:00 2026 +0200 @@ -43,7 +43,5 @@ virtual void Submit(IRunnable* runnable /* takes ownership */) = 0; virtual void Stop() = 0; - - virtual unsigned int GetCountThreads() = 0; }; } diff -r d28c3fb90bd6 -r edd68dfbdd98 OrthancFramework/Sources/MultiThreading/ThreadPool.cpp --- a/OrthancFramework/Sources/MultiThreading/ThreadPool.cpp Mon Jun 29 15:47:19 2026 +0200 +++ b/OrthancFramework/Sources/MultiThreading/ThreadPool.cpp Mon Jun 29 16:03:00 2026 +0200 @@ -304,7 +304,7 @@ } - void ThreadPool::SetCountThreads(unsigned int count) + void ThreadPool::SetThreadsCount(unsigned int count) { if (count < 1) { @@ -326,7 +326,7 @@ } - unsigned int ThreadPool::GetCountThreads() + unsigned int ThreadPool::GetThreadsCount() { boost::mutex::scoped_lock lock(mutex_); return countThreads_; diff -r d28c3fb90bd6 -r edd68dfbdd98 OrthancFramework/Sources/MultiThreading/ThreadPool.h --- a/OrthancFramework/Sources/MultiThreading/ThreadPool.h Mon Jun 29 15:47:19 2026 +0200 +++ b/OrthancFramework/Sources/MultiThreading/ThreadPool.h Mon Jun 29 16:03:00 2026 +0200 @@ -68,9 +68,9 @@ void SetLoggingThreadName(const std::string& name); - void SetCountThreads(unsigned int count); + void SetThreadsCount(unsigned int count); - virtual unsigned int GetCountThreads() ORTHANC_OVERRIDE; + unsigned int GetThreadsCount(); void SetDequeueTimeout(unsigned int milliseconds); diff -r d28c3fb90bd6 -r edd68dfbdd98 OrthancFramework/UnitTestsSources/JobsTests.cpp --- a/OrthancFramework/UnitTestsSources/JobsTests.cpp Mon Jun 29 15:47:19 2026 +0200 +++ b/OrthancFramework/UnitTestsSources/JobsTests.cpp Mon Jun 29 16:03:00 2026 +0200 @@ -1843,10 +1843,10 @@ TEST(ThreadPool, Basic) { ThreadPool pool; - ASSERT_THROW(pool.SetCountThreads(0), OrthancException); + ASSERT_THROW(pool.SetThreadsCount(0), OrthancException); ASSERT_THROW(pool.SetDequeueTimeout(0), OrthancException); pool.SetDequeueTimeout(1); // Ensure fast shutdown in unit tests - ASSERT_EQ(1u, pool.GetCountThreads()); + ASSERT_EQ(1u, pool.GetThreadsCount()); ASSERT_EQ(1u, pool.GetDequeueTimeout()); pool.Start(); diff -r d28c3fb90bd6 -r edd68dfbdd98 OrthancServer/Sources/ServerContext.cpp --- a/OrthancServer/Sources/ServerContext.cpp Mon Jun 29 15:47:19 2026 +0200 +++ b/OrthancServer/Sources/ServerContext.cpp Mon Jun 29 16:03:00 2026 +0200 @@ -747,7 +747,7 @@ // For streaming { boost::shared_ptr pool(new ThreadPool); - pool->SetCountThreads(storageLoaderThreads); + pool->SetThreadsCount(storageLoaderThreads); pool->SetLoggingThreadName("STORAGE-SRC"); pool->SetDequeueTimeout(100); pool->SetMetricsConfiguration(*metricsRegistry_, METRICS_STORAGE_THREAD_POOL_AVAILABLE_THREADS); @@ -775,7 +775,7 @@ { boost::shared_ptr pool(new ThreadPool); - pool->SetCountThreads(dicomParserThreads); + pool->SetThreadsCount(dicomParserThreads); pool->SetLoggingThreadName("DICOM-SRC"); pool->SetDequeueTimeout(100); pool->SetMetricsConfiguration(*metricsRegistry_, METRICS_DICOM_PARSER_THREAD_POOL_AVAILABLE_THREADS); @@ -800,7 +800,7 @@ if (transcoder_.get() != NULL) { boost::shared_ptr pool(new ThreadPool); - pool->SetCountThreads(transcoderThreads); + pool->SetThreadsCount(transcoderThreads); pool->SetLoggingThreadName("TRANSCODER"); pool->SetDequeueTimeout(100); pool->SetMetricsConfiguration(*metricsRegistry_, METRICS_TRANSCODER_THREAD_POOL_AVAILABLE_THREADS); @@ -831,7 +831,7 @@ // } std::unique_ptr pool(new ThreadPool); - pool->SetCountThreads(sequentialReaderThreads); // TODO-Streaming - Check - clarify the difference between SequentialLoader and DataSourceReader + pool->SetThreadsCount(sequentialReaderThreads); // TODO-Streaming - Check - clarify the difference between SequentialLoader and DataSourceReader pool->SetLoggingThreadName("SEQ-READER"); pool->SetDequeueTimeout(100); pool->SetMetricsConfiguration(*metricsRegistry_, METRICS_SEQ_READER_THREAD_POOL_AVAILABLE_THREADS); @@ -2422,12 +2422,24 @@ { storageMemoryCapacityMb = storageAreaReader_->GetCapacity(); storageMemoryCacheMb = storageAreaReader_->GetCacheCapacity(); - storageReaderThreadsCount = storageAreaReader_->GetThreadsCount(); transcoderMemoryCapacityMb = transcoderReader_->GetCapacity(); transcoderMemoryCacheMb = transcoderReader_->GetCacheCapacity(); - transcoderReaderThreadsCount = transcoderReader_->GetThreadsCount(); dicomParserMemoryCapacityMb = dicomReader_->GetCapacity(); dicomParserMemoryCacheMb = dicomReader_->GetCacheCapacity(); - dicomParserThreadsCount = dicomReader_->GetThreadsCount(); + + { + boost::shared_ptr service = storageAreaReader_->GetExecutorService(); + storageReaderThreadsCount = dynamic_cast(*service).GetThreadsCount(); + } + + { + boost::shared_ptr service = transcoderReader_->GetExecutorService(); + transcoderReaderThreadsCount = dynamic_cast(*service).GetThreadsCount(); + } + + { + boost::shared_ptr service = dicomReader_->GetExecutorService(); + dicomParserThreadsCount = dynamic_cast(*service).GetThreadsCount(); + } } }