14 #define ON_DEBUG if (msgLevel(MSG::DEBUG))
15 #define ON_VERBOSE if (msgLevel(MSG::VERBOSE))
17 #define DEBMSG ON_DEBUG debug()
18 #define VERMSG ON_VERBOSE verbose()
20 using ROOT::Reflex::PluginService;
41 it->service->setServiceManager(0);
62 if (!typeName.haveType()) {
72 if ( (ip = type.find(
"__")) != std::string::npos) {
73 type.erase(ip,type.length());
78 service = PluginService::CreateWithId<IService*>(
type,
name,
static_cast<ISvcLocator*
>(
this));
85 fatal() <<
"Incompatible interface IService version for " << type <<
endmsg;
91 fatal() <<
"No Service factory for " << type <<
" available." <<
endmsg;
122 sc = svc->sysInitialize();
124 sc = svc->sysStart();
129 error() <<
"Unable to initialize service \"" << typeName.name() <<
"\""
167 <<
"Initialization loop detected when creating service \"" << name
176 if( name ==
"ApplicationMgr" ||
180 }
else if ( createIf ){
183 return find(name)->service;
205 return find(name) != m_listsvc.end();
258 if (!it->active)
continue;
260 switch (it->service->FSMState()) {
262 DEBMSG <<
"Service " << name <<
" already initialized" <<
endmsg;
266 sc = it->service->sysInitialize();
268 error() <<
"Unable to initialize Service: " << name <<
endmsg;
272 error() <<
"Service " << name
273 <<
" not in the correct state to be initialized ("
274 << it->service->FSMState() <<
")" <<
endmsg;
293 if (!it->active)
continue;
295 switch (it->service->FSMState()) {
297 DEBMSG <<
"Service " << name
298 <<
" already started" <<
endmsg;
302 sc = it->service->sysStart();
304 error() <<
"Unable to start Service: " << name <<
endmsg;
308 error() <<
"Service " << name
309 <<
" not in the correct state to be started ("
310 << it->service->FSMState() <<
")" <<
endmsg;
330 for (it = tmpList.
rbegin(); it != tmpList.
rend(); ++it ) {
331 if (!it->active)
continue;
333 switch (it->service->FSMState()) {
335 DEBMSG <<
"Service " << name <<
" already stopped" <<
endmsg;
339 sc = it->service->sysStop();
341 error() <<
"Unable to stop Service: " << name <<
endmsg;
345 DEBMSG <<
"Service " << name
346 <<
" not in the correct state to be stopped ("
347 << it->service->FSMState() <<
")" <<
endmsg;
366 for ( it = tmpList.
begin(); it != tmpList.
end(); ++it ) {
367 if (!it->active)
continue;
368 sc = it->service->sysReinitialize();
370 error() <<
"Unable to re-initialize Service: " << it->service->name() <<
endmsg;
389 for ( it = tmpList.
begin(); it != tmpList.
end(); ++it ) {
390 if (!it->active)
continue;
391 sc = it->service->sysRestart();
393 error() <<
"Unable to re-start Service: " << it->service->name() <<
endmsg;
428 for (rit = tmpList.
rbegin(); rit != tmpList.
rend(); ++rit ) {
429 if (!rit->active)
continue;
434 if ( !(rit->service->sysFinalize()).isSuccess() ) {
435 warning() <<
"Finalization of service " << name <<
" failed" <<
endmsg;
441 while (!tmpList.
empty()) {
442 it = tmpList.
begin();
444 const unsigned long rc = it->service->refCount() - 1;
446 <<
" (refCount = " << rc <<
")" <<
endmsg;
448 warning() <<
"Too low reference count for " << name
449 <<
" (should not go below 1 at this point)" <<
endmsg;
450 it->service->addRef();