Changeset 11265
- Timestamp:
- 07/06/11 16:06:48 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/FACT++/src/datalogger.cc
r11261 r11265 385 385 ///Remove all the services associated with a given server 386 386 void RemoveAllServices(const string&); 387 ///Remove a server and all of its services 388 void RemoveServer(const std::string &s); 389 ///Remove all the servers and all subscriptions 390 void RemoveAllServers(); 387 391 }; //DataLogger 388 392 … … 470 474 void DataLogger::AddService(const string& server, const string& service, const string&, bool isCmd) 471 475 { 472 476 //dataLogger does not subscribe to commands 473 477 if (isCmd) 474 478 return; … … 486 490 } 487 491 488 list[service].dimInfo = shared_ptr<DimStampedInfo>(SubscribeToPlease(server, service)); 492 // list[service].dimInfo = shared_ptr<DimStampedInfo>(SubscribeToPlease(server, service)); 493 list[service].dimInfo.reset(SubscribeToPlease(server, service)); 489 494 list[service].server = server; 490 495 list[service].service = service; … … 535 540 Debug("Removed all subscriptions to " + server + "/"); 536 541 } 542 } 543 // -------------------------------------------------------------------------- 544 // 545 //! Remove a given server 546 //! @param s the server to be removed 547 // 548 void DataLogger::RemoveServer(const std::string &s) 549 { 550 if (fServiceSubscriptions.erase(s) != 1) 551 { 552 Error("The server " + s + " to be removed was not in the servers list"); 553 } 554 DimServiceInfoList::RemoveServer(s); 555 } 556 // -------------------------------------------------------------------------- 557 // 558 //! Remove all the server and associated subscriptions 559 // 560 void DataLogger::RemoveAllServers() 561 { 562 fServiceSubscriptions.clear(); 563 DimServiceInfoList::RemoveAllServers(); 537 564 } 538 565 // -------------------------------------------------------------------------- … … 1032 1059 RemoveOldestRunNumber(); 1033 1060 } 1034 dim_unlock();1061 // dim_unlock(); 1035 1062 delete fOpenedNightlyFiles; 1036 1063 delete fOpenedRunFiles; … … 1060 1087 fPreviousStatsUpdateTime = cTime; 1061 1088 //update the service. No need to check if data has been written, because some must have been, otherwise we would not have hit this piece of code 1089 if (fStatVar.writingRate < 0) 1090 fStatVar.writingRate = 0; 1091 if (fStatVar.sizeWritten < 0) 1092 fStatVar.sizeWritten = 0; 1062 1093 fStatsMonitoring->updateService(); 1063 1094 … … 1104 1135 1105 1136 //it may happen that we try to write a dimInfo while closing files. Prevent that with a dim_lock() 1106 dim_lock();1137 // dim_lock(); 1107 1138 1108 1139 //check if the service pointer corresponds to something that we subscribed to … … 1125 1156 { 1126 1157 DimServiceInfoList::infoHandler(); 1127 dim_unlock();1158 // dim_unlock(); 1128 1159 return; 1129 1160 } 1130 1161 if (I->getSize() <= 0 || I->getData()==NULL) 1131 1162 { 1132 dim_unlock(); 1163 // dim_unlock(); 1164 return; 1165 } 1166 if (strlen(I->getFormat()) == 0) 1167 { 1168 ostringstream str; 1169 str << "Format of " << I->getName() << " is empty. Ignoring it"; 1170 Error(str); 1133 1171 return; 1134 1172 } … … 1138 1176 if (I->getTimestamp() == 0) 1139 1177 { 1140 dim_unlock();1178 // dim_unlock(); 1141 1179 return; 1142 1180 } … … 1149 1187 ReportPlease(I, y->second); 1150 1188 1151 dim_unlock();1189 // dim_unlock(); 1152 1190 //update the fits files sizes 1153 1191 UpdateStatisticsService(); … … 1436 1474 str << " failed: " << e.what(); 1437 1475 Error(str); 1476 // if (fDebugIsOn) 1477 // { 1478 // ostringstream str2; 1479 // str2 << sub.dimInfo->getString() << "\n"; 1480 // Debug(str2); 1481 // } 1438 1482 return; 1439 1483 } … … 2318 2362 //it may be that dim tries to write a dimInfo at the same time as we're closing files. Prevent this 2319 2363 2320 dim_lock();2364 // dim_lock(); 2321 2365 for (list<RunNumberType>::const_iterator it=fRunNumber.begin(); it != fRunNumber.end(); it++) 2322 2366 { … … 2352 2396 RemoveOldestRunNumber(); 2353 2397 } 2354 dim_unlock();2398 // dim_unlock(); 2355 2399 return kSM_WaitingRun; 2356 2400 } … … 2370 2414 StopRunPlease(); 2371 2415 //it may be that dim tries to write a dimInfo while we're closing files. Prevent that 2372 dim_lock();2416 // dim_lock(); 2373 2417 const string baseFileName = CompileFileNameWithPath(fNightlyFilePath, "", ""); 2374 2418 if (fNightlyLogFile.is_open()) … … 2401 2445 CreateFitsGrouping(fOpenedNightlyFits, 0); 2402 2446 #endif 2403 dim_unlock();2447 // dim_unlock(); 2404 2448 return kSM_Ready; 2405 2449 }
Note:
See TracChangeset
for help on using the changeset viewer.