private void compareAndTakeAction(JsMEConfig newConfig) {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
            SibTr.entry(tc, "compareAndTakeAction", newConfig);
        }

        // newDestinationSet is a sorted set containing the destination id of
        // new config object
        TreeSet<String> newDestinationSet = new TreeSet<String>(newConfig
                        .getMessagingEngine().getDestinationList().keySet());
        // oldDestinationSet is a sorted set containing the destination id of
        // old config object
        TreeSet<String> oldDestinationSet = new TreeSet<String>(jsMEConfig
                        .getMessagingEngine().getDestinationList().keySet());
        // completeDestinationSet is union of newDestinationSet and
        // oldDestinationSet
        TreeSet<String> completeDestinationSet = new TreeSet<String>();
        // continas the destinations which are deleted
        TreeSet<String> deletedDestinationSet = new TreeSet<String>();
        // contains the destinations which are added
        TreeSet<String> addedDestinationSet = new TreeSet<String>();
        // contains the modified destinations.It will first have the destinations which is modified or the unalteed destiantion
        //Then via a logic some of the same destinations will be removed so that it will have only the modified destinations
        TreeSet<String> modifiedDestinationSet = new TreeSet<String>();

        completeDestinationSet.addAll(oldDestinationSet);
        completeDestinationSet.addAll(newDestinationSet);

        Iterator it = completeDestinationSet.iterator();

        //identify the destinations which has to be added, deleted or modified and create a set 
        while (it.hasNext()) {
            String key = (String) it.next();

            if (jsMEConfig.getMessagingEngine().getDestinationList()
                            .containsKey(key)) {// check if the key exists in old set
                if (newConfig.getMessagingEngine().getDestinationList()
                                .containsKey(key)) {// check if the key exists in new
                    // set.if yes then destination might
                    // have been modified or it might have not been altered
                    modifiedDestinationSet.add(key);
                } else {// destination have been deleted
                    deletedDestinationSet.add(key);
                }
            } else {// destination does not exist in old set.Implies a new
                // destiantion has been added
                addedDestinationSet.add(key);
            }
        }

        //iterate through the modifiedDestinationSet to set the UUID
        //This is done because when modified is called a new jsMeConfiG Object is created
        //and the UUID information is lost.Hence we try to restore the UUID for both destination and the localization
        Iterator mit = modifiedDestinationSet.iterator();
        while (mit.hasNext()) {
            String meName = newConfig.getMessagingEngine().getName();
            String destinationName = (String) mit.next();

            // set the UUID of the destination
            newConfig.getMessagingEngine().getDestinationList().get(destinationName)
                            .setUUID(
                                     jsMEConfig.getMessagingEngine()
                                                     .getDestinationList().get(destinationName).getUUID());

            BaseDestination bd = newConfig.getMessagingEngine().getDestinationList().get(destinationName);

            //Localization is not applicable for alias type.Hence the check is made to see if its local
            if (bd.isLocal()) {

                String uuid = jsMEConfig.getMessagingEngine().getSibLocalizationPointList().get(destinationName + "@" + meName).getUuid();
                String targetUuid = jsMEConfig.getMessagingEngine().getSibLocalizationPointList().get(destinationName + "@" + meName).getTargetUuid();

                //set the uuid and targetuuid of the localization
                newConfig.getMessagingEngine().getSibLocalizationPointList().get(destinationName + "@" + meName).setUuid(uuid);
                newConfig.getMessagingEngine().getSibLocalizationPointList().get(destinationName + "@" + meName).setTargetUuid(targetUuid);

            }

        }

        // now check in modifiedDestinationSet to see if at all anything have
        // changed. If nothing is changed we just ignore it
        mit = modifiedDestinationSet.iterator();
        while (mit.hasNext()) {
            String key = (String) mit.next();
            BaseDestination modifiedDestination = newConfig.getMessagingEngine()
                            .getDestinationList().get(key);
            BaseDestination oldDestination = jsMEConfig.getMessagingEngine()
                            .getDestinationList().get(key);

            // if the properties are different then remove destination from modifiedDestinationSet, else do nothing(i.e retain it in the set)
            // IMP : here equals() used is overridden method
            if (modifiedDestination.isLocal()) {
                if (((SIBDestination) modifiedDestination).equals(oldDestination))
                    mit.remove(); // remove the destination from the modifiedDestinationSet as both the objects are equal

            } else if (modifiedDestination.isAlias()) {
                if (((AliasDestination) modifiedDestination).equals(oldDestination))
                    mit.remove(); // remove the destination from the modifiedDestinationSet as both the objects are equal
            }
        }

        // Check if the highMessageThreshold is different.If yes then invoke reloadEngine() 
        if (jsMEConfig.getMessagingEngine().getHighMessageThreshold() != newConfig.getMessagingEngine().getHighMessageThreshold()) {
            try {
                _jsMainImpl.reloadEngine(newConfig.getMessagingEngine().getHighMessageThreshold());
            } catch (Exception e) {
                SibTr.exception(tc, e);
                FFDCFilter.processException(e, this.getClass().getName(), "972", this);
            }
        }
        Iterator dit = deletedDestinationSet.iterator();
        while (dit.hasNext()) {
            String key = (String) dit.next();
            // deleted SIBDestination can be got from the old jsMEConfig
            try {
                _jsMainImpl.deleteDestinationLocalization(jsMEConfig
                                .getMessagingEngine().getDestinationList().get(
                                                                               (key)));
            } catch (Exception e) {
                SibTr.exception(tc, e);
                FFDCFilter.processException(e, this.getClass().getName(), "974", this);
            }
        }
        Iterator nit = addedDestinationSet.iterator();
        while (nit.hasNext()) {
            String key = (String) nit.next();
            // New SIBDestination can be got from the new jsMEConfig
            try {
                _jsMainImpl.createDestinationLocalization(newConfig
                                .getMessagingEngine().getDestinationList().get(
                                                                               (key)));
            } catch (Exception e) {
                SibTr.exception(tc, e);
                FFDCFilter.processException(e, this.getClass().getName(), "992", this);
            }
        }
        Iterator mmit = modifiedDestinationSet.iterator();
        while (mmit.hasNext()) {
            String key = (String) mmit.next();
            // Modified SIBDestination can be got from the new jsMEConfig
            try {
                _jsMainImpl.alterDestinationLocalization(newConfig
                                .getMessagingEngine().getDestinationList().get(
                                                                               (key)));
            } catch (Exception e) {
                SibTr.exception(tc, e);
                FFDCFilter.processException(e, this.getClass().getName(), "1010", this);
            }
        }
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
            SibTr.exit(tc, "compareAndTakeAction");
        }

    }
private void compareAndTakeAction ( JsMEConfig newConfig ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { SibTr . entry ( tc , "compareAndTakeAction" , newConfig ) ; } TreeSet < String > newDestinationSet = new TreeSet < String > ( newConfig . getMessagingEngine ( ) . getDestinationList ( ) . keySet ( ) ) ; TreeSet < String > oldDestinationSet = new TreeSet < String > ( jsMEConfig . getMessagingEngine ( ) . getDestinationList ( ) . keySet ( ) ) ; TreeSet < String > completeDestinationSet = new TreeSet < String > ( ) ; TreeSet < String > deletedDestinationSet = new TreeSet < String > ( ) ; TreeSet < String > addedDestinationSet = new TreeSet < String > ( ) ; TreeSet < String > modifiedDestinationSet = new TreeSet < String > ( ) ; completeDestinationSet . addAll ( oldDestinationSet ) ; completeDestinationSet . addAll ( newDestinationSet ) ; Iterator it = completeDestinationSet . iterator ( ) ; while ( it . hasNext ( ) ) { String key = ( String ) it . next ( ) ; if ( jsMEConfig . getMessagingEngine ( ) . getDestinationList ( ) . containsKey ( key ) ) { if ( newConfig . getMessagingEngine ( ) . getDestinationList ( ) . containsKey ( key ) ) { modifiedDestinationSet . add ( key ) ; } else { deletedDestinationSet . add ( key ) ; } } else { addedDestinationSet . add ( key ) ; } } Iterator mit = modifiedDestinationSet . iterator ( ) ; while ( mit . hasNext ( ) ) { String meName = newConfig . getMessagingEngine ( ) . getName ( ) ; String destinationName = ( String ) mit . next ( ) ; newConfig . getMessagingEngine ( ) . getDestinationList ( ) . get ( destinationName ) . setUUID ( jsMEConfig . getMessagingEngine ( ) . getDestinationList ( ) . get ( destinationName ) . getUUID ( ) ) ; BaseDestination bd = newConfig . getMessagingEngine ( ) . getDestinationList ( ) . get ( destinationName ) ; if ( bd . isLocal ( ) ) { String uuid = jsMEConfig . getMessagingEngine ( ) . getSibLocalizationPointList ( ) . get ( destinationName + "@" + meName ) . getUuid ( ) ; String targetUuid = jsMEConfig . getMessagingEngine ( ) . getSibLocalizationPointList ( ) . get ( destinationName + "@" + meName ) . getTargetUuid ( ) ; newConfig . getMessagingEngine ( ) . getSibLocalizationPointList ( ) . get ( destinationName + "@" + meName ) . setUuid ( uuid ) ; newConfig . getMessagingEngine ( ) . getSibLocalizationPointList ( ) . get ( destinationName + "@" + meName ) . setTargetUuid ( targetUuid ) ; } } mit = modifiedDestinationSet . iterator ( ) ; while ( mit . hasNext ( ) ) { String key = ( String ) mit . next ( ) ; BaseDestination modifiedDestination = newConfig . getMessagingEngine ( ) . getDestinationList ( ) . get ( key ) ; BaseDestination oldDestination = jsMEConfig . getMessagingEngine ( ) . getDestinationList ( ) . get ( key ) ; if ( modifiedDestination . isLocal ( ) ) { if ( ( ( SIBDestination ) modifiedDestination ) . equals ( oldDestination ) ) mit . remove ( ) ; } else if ( modifiedDestination . isAlias ( ) ) { if ( ( ( AliasDestination ) modifiedDestination ) . equals ( oldDestination ) ) mit . remove ( ) ; } } if ( jsMEConfig . getMessagingEngine ( ) . getHighMessageThreshold ( ) != newConfig . getMessagingEngine ( ) . getHighMessageThreshold ( ) ) { try { _jsMainImpl . reloadEngine ( newConfig . getMessagingEngine ( ) . getHighMessageThreshold ( ) ) ; } catch ( Exception e ) { SibTr . exception ( tc , e ) ; FFDCFilter . processException ( e , this . getClass ( ) . getName ( ) , "972" , this ) ; } } Iterator dit = deletedDestinationSet . iterator ( ) ; while ( dit . hasNext ( ) ) { String key = ( String ) dit . next ( ) ; try { _jsMainImpl . deleteDestinationLocalization ( jsMEConfig . getMessagingEngine ( ) . getDestinationList ( ) . get ( ( key ) ) ) ; } catch ( Exception e ) { SibTr . exception ( tc , e ) ; FFDCFilter . processException ( e , this . getClass ( ) . getName ( ) , "974" , this ) ; } } Iterator nit = addedDestinationSet . iterator ( ) ; while ( nit . hasNext ( ) ) { String key = ( String ) nit . next ( ) ; try { _jsMainImpl . createDestinationLocalization ( newConfig . getMessagingEngine ( ) . getDestinationList ( ) . get ( ( key ) ) ) ; } catch ( Exception e ) { SibTr . exception ( tc , e ) ; FFDCFilter . processException ( e , this . getClass ( ) . getName ( ) , "992" , this ) ; } } Iterator mmit = modifiedDestinationSet . iterator ( ) ; while ( mmit . hasNext ( ) ) { String key = ( String ) mmit . next ( ) ; try { _jsMainImpl . alterDestinationLocalization ( newConfig . getMessagingEngine ( ) . getDestinationList ( ) . get ( ( key ) ) ) ; } catch ( Exception e ) { SibTr . exception ( tc , e ) ; FFDCFilter . processException ( e , this . getClass ( ) . getName ( ) , "1010" , this ) ; } } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { SibTr . exit ( tc , "compareAndTakeAction" ) ; } }
Compares the old and new config object to identify the changes.
Appropriate actions are taken on the changes i) First 2 objects are
compared to identify the addition and deletion of destinations ii) Second
2 objects are comapred to identify the retained destination. It can mean
two things either the destinations are not at all changed or the
attributes are changed

@param newConfig