public void startDiscProcessBetweenChannels ( InboundChannel appChannel , InboundChannel devChannel , int discWeight ) throws ChainException { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { Tr . entry ( tc , "startDiscProcessBetweenChannels" ) ; } // Get the discriminator for the app channel. Protect from misc exceptions being thrown. Discriminator d = null ; Exception discException = null ; try { d = appChannel . getDiscriminator ( ) ; if ( d == null ) { discException = new Exception ( "Null discriminator extracted from channel " + appChannel . getName ( ) ) ; } } catch ( Exception e ) { // No FFDC needed. Done a couple lines down. discException = e ; } if ( null != discException ) { // Even though rethrowing exception, must FFDC now to capture stack trace. FFDCFilter . processException ( discException , getClass ( ) . getName ( ) + ".startDiscProcessBetweenChannels" , "234" , this , new Object [ ] { appChannel , devChannel , Integer . valueOf ( discWeight ) } ) ; throw new ChainException ( "Unable to get discriminator from " + appChannel . getName ( ) , discException ) ; } // Get the discrimination group from the former channel in the chain. DiscriminationGroup prevDg = ( DiscriminationGroup ) devChannel . getDiscriminationProcess ( ) ; // Check to see if the disc group already includes the discriminator. if ( ! ( ( DiscriminationProcessImpl ) prevDg ) . containsDiscriminator ( d ) ) { // Add this discriminator or create a new one? if ( ! ( prevDg . getDiscriminators ( ) . isEmpty ( ) ) ) { // Add a new DiscriminationProcess to a started channel if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Create new dp for channel, " + devChannel . getName ( ) ) ; } DiscriminationGroup newDg = new DiscriminationProcessImpl ( devChannel . getDiscriminatoryType ( ) , prevDg ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Add in discriminator from channel, " + appChannel . getName ( ) ) ; } newDg . addDiscriminator ( d , discWeight ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Set dp into channel, " + devChannel . getName ( ) ) ; } newDg . start ( ) ; devChannel . setDiscriminationProcess ( newDg ) ; } else { // Enable the previous channel in the chain to communication with this one. if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Add in disc from channel, " + appChannel . getName ( ) + " into dp of channel, " + devChannel . getName ( ) ) ; } prevDg . addDiscriminator ( d , discWeight ) ; prevDg . start ( ) ; } } else { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Found discriminator in dp, " + appChannel . getName ( ) ) ; } } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { Tr . exit ( tc , "startDiscProcessBetweenChannels" ) ; } }
This method is called from ChannelFrameworkImpl during chain startup to start up the discrimination process between each set of adjacent channels in the chain .