private void addSubscriptionsToBus ( BusGroup group , String busId ) throws SIResourceException { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "addSubscriptionsToBus" , new Object [ ] { group , busId } ) ; // Get the complete list of Subscriptions from the MatchSpace // and assign to the BusGroup. final ArrayList cdList = _proxyHandler . getMessageProcessor ( ) . getMessageProcessorMatching ( ) . getAllCDMatchTargets ( ) ; // Iterate through the list of available "subscriptions". final Iterator cdIterator = cdList . listIterator ( ) ; while ( cdIterator . hasNext ( ) ) { // Get the Consumer Dispatcher for this element. final ConsumerDispatcher cd = ( ConsumerDispatcher ) cdIterator . next ( ) ; // This won't actually send the subscriptions to the Neighbour // but generates the list of topics that are to be propagated. group . addLocalSubscription ( cd . getConsumerDispatcherState ( ) , null , null , false ) ; } // Add proxy subscriptions that have been registered by // Neighbouring ME's. final ArrayList phList = _proxyHandler . getMessageProcessor ( ) . getMessageProcessorMatching ( ) . getAllPubSubOutputHandlerMatchTargets ( ) ; final ArrayList outputSeenList = new ArrayList ( ) ; final Iterator phIterator = phList . listIterator ( ) ; while ( phIterator . hasNext ( ) ) { // Get the PubSub OutputHandler for this element. final PubSubOutputHandler oh = ( PubSubOutputHandler ) phIterator . next ( ) ; if ( ! outputSeenList . contains ( oh ) && oh . neighbourOnDifferentBus ( busId ) ) { // This won't actually send the subscriptions to the Neighbour // but generates the list of topics that are to be propagated. final String topics [ ] = oh . getTopics ( ) ; final SIBUuid12 topicSpaceUuid = oh . getTopicSpaceUuid ( ) ; if ( topics != null && topics . length > 0 ) { for ( int i = 0 ; i < topics . length ; i ++ ) { group . addRemoteSubscription ( topicSpaceUuid , topics [ i ] , null , false ) ; } } // Add the neighbour to the list of seen Neighbours. outputSeenList . add ( oh ) ; } } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "addSubscriptionsToBus" ) ; }
Adds the subscriptions to the Bus