| 917 | } |
| 918 | |
| 919 | Manager_ptr |
| 920 | ManagerImpl::join_federation( |
| 921 | Manager_ptr peer, |
| 922 | FederationDomain federation |
| 923 | ) |
| 924 | { |
| 925 | if (OpenDDS::DCPS::DCPS_debug_level > 0) { |
| 926 | ACE_DEBUG((LM_DEBUG, |
| 927 | ACE_TEXT("(%P|%t) ManagerImpl::join_federation( peer, %d)\n"), |
| 928 | federation)); |
| 929 | } |
| 930 | |
| 931 | RepoKey remote = NIL_REPOSITORY; |
| 932 | |
| 933 | try { |
| 934 | // Obtain the remote repository federator Id value. |
| 935 | remote = peer->federation_id(); |
| 936 | |
| 937 | if (OpenDDS::DCPS::DCPS_debug_level > 0) { |
| 938 | ACE_DEBUG((LM_DEBUG, |
| 939 | ACE_TEXT("(%P|%t) Federator::ManagerImpl::join_federation() - ") |
| 940 | ACE_TEXT("repo id %d entered from repository with id %d.\n"), |
| 941 | this->id().id(), |
| 942 | remote)); |
| 943 | } |
| 944 | |
| 945 | } catch (const CORBA::Exception& ex) { |
| 946 | ex._tao_print_exception( |
| 947 | ACE_TEXT("ERROR: Federator::ManagerImpl::join_federation() - ") |
| 948 | ACE_TEXT("unable to obtain remote federation Id value: ")); |
| 949 | throw Incomplete(); |
| 950 | } |
| 951 | |
| 952 | // If we are recursing, then we are done. |
| 953 | if (this->joiner_ == remote) { |
| 954 | if (OpenDDS::DCPS::DCPS_debug_level > 0) { |
| 955 | ACE_DEBUG((LM_DEBUG, |
| 956 | ACE_TEXT("(%P|%t) Federator::ManagerImpl::join_federation() - ") |
| 957 | ACE_TEXT("repo id %d leaving after reentry from repository with id %d.\n"), |
| 958 | this->id().id(), |
| 959 | remote)); |
| 960 | } |
| 961 | |
| 962 | return this->_this(); |
| 963 | |
| 964 | } else { |
| 965 | // Block while any different repository is joining. |
| 966 | ACE_GUARD_RETURN(ACE_SYNCH_MUTEX, guard, this->lock_, 0); |
| 967 | |
| 968 | while (this->joiner_ != NIL_REPOSITORY) { |
| 969 | // This releases the lock while we block. |
| 970 | this->joining_.wait(); |
| 971 | |
| 972 | // We are now recursing - curses! |
| 973 | if (this->joiner_ == remote) { |
| 974 | return this->_this(); |
| 975 | } |
| 976 | } |
no test coverage detected