comparison OrthancServer/ServerContext.cpp @ 2610:3ff4c50647ea jobs

moving the old scheduler to the graveyard
author Sebastien Jodogne <s.jodogne@gmail.com>
date Sat, 19 May 2018 16:40:26 +0200
parents 2e879c796ec7
children 2f3007bf0708
comparison
equal deleted inserted replaced
2609:f7a84b551ee4 2610:3ff4c50647ea
43 #include "OrthancInitialization.h" 43 #include "OrthancInitialization.h"
44 44
45 #include <EmbeddedResources.h> 45 #include <EmbeddedResources.h>
46 #include <dcmtk/dcmdata/dcfilefo.h> 46 #include <dcmtk/dcmdata/dcfilefo.h>
47 47
48
49 #include "Scheduler/CallSystemCommand.h"
50 #include "Scheduler/DeleteInstanceCommand.h"
51 #include "Scheduler/ModifyInstanceCommand.h"
52 #include "Scheduler/StoreScuCommand.h"
53 #include "Scheduler/StorePeerCommand.h"
54 #include "OrthancRestApi/OrthancRestApi.h" 48 #include "OrthancRestApi/OrthancRestApi.h"
55 #include "../Plugins/Engine/OrthancPlugins.h" 49 #include "../Plugins/Engine/OrthancPlugins.h"
56 #include "Search/LookupResource.h" 50 #include "Search/LookupResource.h"
57 51
58 52
118 area_(area), 112 area_(area),
119 compressionEnabled_(false), 113 compressionEnabled_(false),
120 storeMD5_(true), 114 storeMD5_(true),
121 provider_(*this), 115 provider_(*this),
122 dicomCache_(provider_, DICOM_CACHE_SIZE), 116 dicomCache_(provider_, DICOM_CACHE_SIZE),
123 scheduler_(Configuration::GetGlobalUnsignedIntegerParameter("LimitJobs", 10)),
124 lua_(*this), 117 lua_(*this),
125 #if ORTHANC_ENABLE_PLUGINS == 1 118 #if ORTHANC_ENABLE_PLUGINS == 1
126 plugins_(NULL), 119 plugins_(NULL),
127 #endif 120 #endif
128 done_(false), 121 done_(false),
129 queryRetrieveArchive_(Configuration::GetGlobalUnsignedIntegerParameter("QueryRetrieveSize", 10)), 122 queryRetrieveArchive_(Configuration::GetGlobalUnsignedIntegerParameter("QueryRetrieveSize", 10)),
130 defaultLocalAet_(Configuration::GetGlobalStringParameter("DicomAet", "ORTHANC")) 123 defaultLocalAet_(Configuration::GetGlobalStringParameter("DicomAet", "ORTHANC"))
131 { 124 {
132 uint64_t s = Configuration::GetGlobalUnsignedIntegerParameter("DicomAssociationCloseDelay", 5); // In seconds
133 scu_.SetMillisecondsBeforeClose(s * 1000); // Milliseconds are expected here
134
135 listeners_.push_back(ServerListener(lua_, "Lua")); 125 listeners_.push_back(ServerListener(lua_, "Lua"));
136 126
137 jobsEngine_.SetWorkersCount(Configuration::GetGlobalUnsignedIntegerParameter("ConcurrentJobs", 2)); 127 jobsEngine_.SetWorkersCount(Configuration::GetGlobalUnsignedIntegerParameter("ConcurrentJobs", 2));
138 //jobsEngine_.SetMaxCompleted // TODO 128 //jobsEngine_.SetMaxCompleted // TODO
139 jobsEngine_.Start(); 129 jobsEngine_.Start();
167 if (changeThread_.joinable()) 157 if (changeThread_.joinable())
168 { 158 {
169 changeThread_.join(); 159 changeThread_.join();
170 } 160 }
171 161
172 scu_.Finalize();
173
174 // Do not change the order below! 162 // Do not change the order below!
175 jobsEngine_.Stop(); 163 jobsEngine_.Stop();
176 scheduler_.Stop();
177 index_.Stop(); 164 index_.Stop();
178 } 165 }
179 } 166 }
180 167
181 168