comparison Framework/Oracle/ThreadedOracle.cpp @ 765:f6438fdc447e

cont
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 23 May 2019 14:57:52 +0200
parents 1181e1ad98ec
children a68cd7ae8838
comparison
equal deleted inserted replaced
764:f36a6f7e7bdf 765:f6438fdc447e
202 std::string compressed; 202 std::string compressed;
203 answer.swap(compressed); 203 answer.swap(compressed);
204 204
205 Orthanc::GzipCompressor compressor; 205 Orthanc::GzipCompressor compressor;
206 compressor.Uncompress(answer, compressed.c_str(), compressed.size()); 206 compressor.Uncompress(answer, compressed.c_str(), compressed.size());
207
208 LOG(INFO) << "Uncompressing gzip Encoding: from " << compressed.size()
209 << " to " << answer.size() << " bytes";
207 } 210 }
208 } 211 }
209 212
210 213
211 static void Execute(IMessageEmitter& emitter, 214 static void Execute(IMessageEmitter& emitter,
422 sleepingTimeResolution_(50) // By default, time resolution of 50ms 425 sleepingTimeResolution_(50) // By default, time resolution of 50ms
423 { 426 {
424 } 427 }
425 428
426 429
430 ThreadedOracle::~ThreadedOracle()
431 {
432 if (state_ == State_Running)
433 {
434 LOG(ERROR) << "The threaded oracle is still running, explicit call to "
435 << "Stop() is mandatory to avoid crashes";
436 }
437
438 try
439 {
440 StopInternal();
441 }
442 catch (Orthanc::OrthancException& e)
443 {
444 LOG(ERROR) << "Exception while stopping the threaded oracle: " << e.What();
445 }
446 catch (...)
447 {
448 LOG(ERROR) << "Native exception while stopping the threaded oracle";
449 }
450 }
451
452
427 void ThreadedOracle::SetOrthancParameters(const Orthanc::WebServiceParameters& orthanc) 453 void ThreadedOracle::SetOrthancParameters(const Orthanc::WebServiceParameters& orthanc)
428 { 454 {
429 boost::mutex::scoped_lock lock(mutex_); 455 boost::mutex::scoped_lock lock(mutex_);
430 456
431 if (state_ != State_Setup) 457 if (state_ != State_Setup)