comparison OrthancServer/ServerJobs/LuaJobManager.cpp @ 2608:25225f0b4f33 jobs

simplification wrt. dicom connection manager
author Sebastien Jodogne <s.jodogne@gmail.com>
date Sat, 19 May 2018 15:50:09 +0200
parents 44e268605478
children f7a84b551ee4
comparison
equal deleted inserted replaced
2607:44e268605478 2608:25225f0b4f33
45 #include "../../Core/JobsEngine/Operations/StringOperationValue.h" 45 #include "../../Core/JobsEngine/Operations/StringOperationValue.h"
46 #include "DicomInstanceOperationValue.h" 46 #include "DicomInstanceOperationValue.h"
47 47
48 namespace Orthanc 48 namespace Orthanc
49 { 49 {
50 void LuaJobManager::ConnectionTimeoutThread(LuaJobManager* manager)
51 {
52 while (manager->continue_)
53 {
54 manager->connectionManager_.CheckTimeout();
55 boost::this_thread::sleep(boost::posix_time::milliseconds(100));
56 }
57 }
58
59
60 void LuaJobManager::SignalDone(const SequenceOfOperationsJob& job) 50 void LuaJobManager::SignalDone(const SequenceOfOperationsJob& job)
61 { 51 {
62 boost::mutex::scoped_lock lock(mutex_); 52 boost::mutex::scoped_lock lock(mutex_);
63 53
64 if (&job == currentJob_) 54 if (&job == currentJob_)
70 60
71 61
72 LuaJobManager::LuaJobManager() : 62 LuaJobManager::LuaJobManager() :
73 currentJob_(NULL), 63 currentJob_(NULL),
74 maxOperations_(1000), 64 maxOperations_(1000),
75 priority_(0), 65 priority_(0)
76 continue_(true) 66 {
77 {
78 connectionTimeoutThread_ = boost::thread(ConnectionTimeoutThread, this);
79 }
80
81
82 LuaJobManager::~LuaJobManager()
83 {
84 continue_ = false;
85
86 if (connectionTimeoutThread_.joinable())
87 {
88 connectionTimeoutThread_.join();
89 }
90 } 67 }
91 68
92 69
93 void LuaJobManager::SetMaxOperationsPerJob(size_t count) 70 void LuaJobManager::SetMaxOperationsPerJob(size_t count)
94 { 71 {
178 155
179 size_t LuaJobManager::Lock::AddStoreScuOperation(const std::string& localAet, 156 size_t LuaJobManager::Lock::AddStoreScuOperation(const std::string& localAet,
180 const RemoteModalityParameters& modality) 157 const RemoteModalityParameters& modality)
181 { 158 {
182 assert(jobLock_.get() != NULL); 159 assert(jobLock_.get() != NULL);
183 return jobLock_->AddOperation 160 return jobLock_->AddOperation(new StoreScuOperation(localAet, modality));
184 (new StoreScuOperation(localAet, modality, that_.connectionManager_));
185 } 161 }
186 162
187 163
188 size_t LuaJobManager::Lock::AddStorePeerOperation(const WebServiceParameters& peer) 164 size_t LuaJobManager::Lock::AddStorePeerOperation(const WebServiceParameters& peer)
189 { 165 {