| 341 | } |
| 342 | |
| 343 | bool |
| 344 | Monitor::MonitorTask::setActiveRepo( RepoKey key) |
| 345 | { |
| 346 | ACE_DEBUG((LM_DEBUG, |
| 347 | ACE_TEXT("(%P|%t) MonitorTask::setActiveRepo() - ") |
| 348 | ACE_TEXT("previous instrumentation has been torn down, ") |
| 349 | ACE_TEXT("establishing new monitoring.\n") |
| 350 | )); |
| 351 | |
| 352 | ACE_GUARD_RETURN(ACE_SYNCH_MUTEX, guard, this->lock_, false); |
| 353 | |
| 354 | if( this->options_.verbose()) { |
| 355 | ACE_DEBUG((LM_DEBUG, |
| 356 | ACE_TEXT("(%P|%t) MonitorTask::setActiveRepo() - ") |
| 357 | ACE_TEXT("rebinding instrumentation domain %d to repository key: %C.\n"), |
| 358 | this->options_.domain(), |
| 359 | key.c_str() |
| 360 | )); |
| 361 | } |
| 362 | |
| 363 | // Remap all domains pointing to the old repository to the new one. |
| 364 | // But do not attach the participant to the repository as the repo |
| 365 | // may not know the monitor domain and monitor also will request |
| 366 | // create_participant. |
| 367 | TheServiceParticipant->remap_domains( this->activeKey_, key, false); |
| 368 | |
| 369 | // Check that the instrumentation domain repository is the new one. |
| 370 | RepoKey monitorKey = TheServiceParticipant->domain_to_repo( |
| 371 | this->options_.domain() |
| 372 | ); |
| 373 | |
| 374 | if(!activeKeyInited_ || monitorKey != key) { |
| 375 | if (!activeKeyInited_) |
| 376 | { |
| 377 | activeKeyInited_ = true; |
| 378 | } |
| 379 | |
| 380 | // Otherwise map the instrumentation domain onto the new repository. |
| 381 | TheServiceParticipant->set_repo_domain( this->options_.domain(), key, false); |
| 382 | } |
| 383 | |
| 384 | // Save the newly active repository key. |
| 385 | this->activeKey_ = key; |
| 386 | |
| 387 | // Fire up a new set of processing with the new repository. |
| 388 | this->participant_ |
| 389 | = TheParticipantFactory->create_participant( |
| 390 | this->options_.domain(), |
| 391 | PARTICIPANT_QOS_DEFAULT, |
| 392 | DDS::DomainParticipantListener::_nil(), |
| 393 | OpenDDS::DCPS::DEFAULT_STATUS_MASK |
| 394 | ); |
| 395 | if( CORBA::is_nil( this->participant_.in())) { |
| 396 | ACE_ERROR((LM_ERROR, |
| 397 | ACE_TEXT("(%P|%t) ERROR: MonitorTask::setActiveRepo() - ") |
| 398 | ACE_TEXT("failed to create participant.\n") |
| 399 | )); |
| 400 | return false; |
no test coverage detected