17 #define ON_DEBUG if (msgLevel(MSG::DEBUG))
18 #define ON_VERBOSE if (msgLevel(MSG::VERBOSE))
20 #define DEBMSG ON_DEBUG debug()
21 #define VERMSG ON_VERBOSE verbose()
42 it->service->setServiceManager(0);
63 if (!typeName.haveType()) {
73 if ( (ip = type.find(
"__")) != std::string::npos) {
74 type.erase(ip,type.length());
77 IService*
service = Service::Factory::create(type, name, static_cast<ISvcLocator*>(
this));
83 fatal() <<
"Incompatible interface IService version for " << type <<
endmsg;
89 fatal() <<
"No Service factory for " << type <<
" available." <<
endmsg;
122 sc = svc->sysInitialize();
124 sc = svc->sysStart();
128 error() <<
"Unable to initialize service \"" << typeName.name() <<
"\""
168 <<
"Initialization loop detected when creating service \"" << name
177 if( name ==
"ApplicationMgr" ||
181 }
else if ( createIf ){
184 return find(name)->service;
206 return find(name) != m_listsvc.end();
259 if (!it->active)
continue;
261 switch (it->service->FSMState()) {
263 DEBMSG <<
"Service " << name <<
" already initialized" <<
endmsg;
267 sc = it->service->sysInitialize();
269 error() <<
"Unable to initialize Service: " << name <<
endmsg;
273 error() <<
"Service " << name
274 <<
" not in the correct state to be initialized ("
275 << it->service->FSMState() <<
")" <<
endmsg;
294 if (!it->active)
continue;
296 switch (it->service->FSMState()) {
298 DEBMSG <<
"Service " << name
299 <<
" already started" <<
endmsg;
303 sc = it->service->sysStart();
305 error() <<
"Unable to start Service: " << name <<
endmsg;
309 error() <<
"Service " << name
310 <<
" not in the correct state to be started ("
311 << it->service->FSMState() <<
")" <<
endmsg;
331 for (it = tmpList.
rbegin(); it != tmpList.
rend(); ++it ) {
332 if (!it->active)
continue;
334 switch (it->service->FSMState()) {
336 DEBMSG <<
"Service " << name <<
" already stopped" <<
endmsg;
340 sc = it->service->sysStop();
342 error() <<
"Unable to stop Service: " << name <<
endmsg;
346 DEBMSG <<
"Service " << name
347 <<
" not in the correct state to be stopped ("
348 << it->service->FSMState() <<
")" <<
endmsg;
367 for ( it = tmpList.
begin(); it != tmpList.
end(); ++it ) {
368 if (!it->active)
continue;
369 sc = it->service->sysReinitialize();
371 error() <<
"Unable to re-initialize Service: " << it->service->name() <<
endmsg;
390 for ( it = tmpList.
begin(); it != tmpList.
end(); ++it ) {
391 if (!it->active)
continue;
392 sc = it->service->sysRestart();
394 error() <<
"Unable to re-start Service: " << it->service->name() <<
endmsg;
444 for (rit = tmpList.
rbegin(); rit != tmpList.
rend(); ++rit ) {
445 if (!rit->active)
continue;
450 if ( !(rit->service->sysFinalize()).isSuccess() ) {
451 warning() <<
"Finalization of service " << name <<
" failed" <<
endmsg;
458 if (!postFinList.
empty()) {
459 DEBMSG <<
"Will call SvcPostFinalize for " << postFinList.
size() <<
" clients"
463 for (itr = postFinList.
begin(); itr != postFinList.
end(); ++itr) {
470 DEBMSG <<
"Looping over all active services..." <<
endmsg;
473 DEBMSG <<
"---- " << it->service->name()
474 <<
" (refCount = " << it->service->refCount() <<
")"
476 if (it->service->refCount() < 1) {
477 warning() <<
"Too low reference count for " << it->service->name()
478 <<
" (should not go below 1 at this point)" <<
endmsg;
479 it->service->addRef();
534 <<
"===================== listing all services ===================\n"
535 <<
" prior ref name active\n";
542 log << it->priority <<
" ";
544 log << it->service->refCount() <<
" ";
547 log << it->service->name() <<
" ";
553 log <<
"=================================================================\n";