18 #define ON_DEBUG if (msgLevel(MSG::DEBUG))
19 #define ON_VERBOSE if (msgLevel(MSG::VERBOSE))
21 #define DEBMSG ON_DEBUG debug()
22 #define VERMSG ON_VERBOSE verbose()
24 using ROOT::Reflex::PluginService;
45 it->service->setServiceManager(0);
66 if (!typeName.haveType()) {
76 if ( (ip = type.find(
"__")) != std::string::npos) {
77 type.erase(ip,type.length());
82 service = PluginService::CreateWithId<IService*>(
type,
name,
static_cast<ISvcLocator*
>(
this));
89 fatal() <<
"Incompatible interface IService version for " << type <<
endmsg;
95 fatal() <<
"No Service factory for " << type <<
" available." <<
endmsg;
128 sc = svc->sysInitialize();
130 sc = svc->sysStart();
134 error() <<
"Unable to initialize service \"" << typeName.name() <<
"\""
174 <<
"Initialization loop detected when creating service \"" << name
183 if( name ==
"ApplicationMgr" ||
187 }
else if ( createIf ){
190 return find(name)->service;
212 return find(name) != m_listsvc.end();
265 if (!it->active)
continue;
267 switch (it->service->FSMState()) {
269 DEBMSG <<
"Service " << name <<
" already initialized" <<
endmsg;
273 sc = it->service->sysInitialize();
275 error() <<
"Unable to initialize Service: " << name <<
endmsg;
279 error() <<
"Service " << name
280 <<
" not in the correct state to be initialized ("
281 << it->service->FSMState() <<
")" <<
endmsg;
300 if (!it->active)
continue;
302 switch (it->service->FSMState()) {
304 DEBMSG <<
"Service " << name
305 <<
" already started" <<
endmsg;
309 sc = it->service->sysStart();
311 error() <<
"Unable to start Service: " << name <<
endmsg;
315 error() <<
"Service " << name
316 <<
" not in the correct state to be started ("
317 << it->service->FSMState() <<
")" <<
endmsg;
337 for (it = tmpList.
rbegin(); it != tmpList.
rend(); ++it ) {
338 if (!it->active)
continue;
340 switch (it->service->FSMState()) {
342 DEBMSG <<
"Service " << name <<
" already stopped" <<
endmsg;
346 sc = it->service->sysStop();
348 error() <<
"Unable to stop Service: " << name <<
endmsg;
352 DEBMSG <<
"Service " << name
353 <<
" not in the correct state to be stopped ("
354 << it->service->FSMState() <<
")" <<
endmsg;
373 for ( it = tmpList.
begin(); it != tmpList.
end(); ++it ) {
374 if (!it->active)
continue;
375 sc = it->service->sysReinitialize();
377 error() <<
"Unable to re-initialize Service: " << it->service->name() <<
endmsg;
396 for ( it = tmpList.
begin(); it != tmpList.
end(); ++it ) {
397 if (!it->active)
continue;
398 sc = it->service->sysRestart();
400 error() <<
"Unable to re-start Service: " << it->service->name() <<
endmsg;
450 for (rit = tmpList.
rbegin(); rit != tmpList.
rend(); ++rit ) {
451 if (!rit->active)
continue;
456 if ( !(rit->service->sysFinalize()).isSuccess() ) {
457 warning() <<
"Finalization of service " << name <<
" failed" <<
endmsg;
464 if (!postFinList.
empty()) {
465 DEBMSG <<
"Will call SvcPostFinalize for " << postFinList.
size() <<
" clients"
469 for (itr = postFinList.
begin(); itr != postFinList.
end(); ++itr) {
476 DEBMSG <<
"Looping over all active services..." <<
endmsg;
479 DEBMSG <<
"---- " << it->service->name()
480 <<
" (refCount = " << it->service->refCount() <<
")"
482 if (it->service->refCount() < 1) {
483 warning() <<
"Too low reference count for " << it->service->name()
484 <<
" (should not go below 1 at this point)" <<
endmsg;
485 it->service->addRef();
540 <<
"===================== listing all services ===================\n"
541 <<
" prior ref name active\n";
548 log << it->priority <<
" ";
550 log << it->service->refCount() <<
" ";
553 log << it->service->name() <<
" ";
559 log <<
"=================================================================\n";