public void disableChannel ( Channel inputChannel ) throws InvalidChannelNameException , DiscriminationProcessException { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { Tr . entry ( tc , "disableChannel: " + inputChannel . getName ( ) ) ; } synchronized ( state ) { if ( RuntimeState . STARTED . equals ( state ) || RuntimeState . QUIESCED . equals ( state ) ) { String targetName = inputChannel . getName ( ) ; int index = 0 ; InboundChannel prevChannel = null ; // Find the index of the input channel in this chain. for ( ; index < channels . length ; index ++ ) { if ( channels [ index ] . getName ( ) . equals ( targetName ) ) { break ; } prevChannel = ( InboundChannel ) channels [ index ] ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Index of channel, " + index ) ; } if ( channels . length == index ) { // Never found the channel. Log an error. InvalidChannelNameException e = new InvalidChannelNameException ( "ERROR: can't unlink unknown channel, " + targetName ) ; FFDCFilter . processException ( e , getClass ( ) . getName ( ) + ".disableChannel" , "319" , this , new Object [ ] { inputChannel } ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { Tr . exit ( tc , "disableChannel" ) ; } throw e ; } else if ( null != prevChannel ) { // Note: do nothing if the index was zero, meaning input channel is a connector. if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Previous channel, " + prevChannel . getName ( ) ) ; } // Discriminator was only added after the chain was started. Class < ? > discriminatoryType = prevChannel . getDiscriminatoryType ( ) ; DiscriminationProcessImpl newDp = new DiscriminationProcessImpl ( discriminatoryType , ( DiscriminationGroup ) prevChannel . getDiscriminationProcess ( ) ) ; newDp . removeDiscriminator ( ( ( InboundChannel ) inputChannel ) . getDiscriminator ( ) ) ; prevChannel . setDiscriminationProcess ( newDp ) ; } } else { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "RuntimeState invalid to disable channel: " + inputChannel . getName ( ) + ", chain state: " + state . ordinal ) ; } } } // End synchronize if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { Tr . exit ( tc , "disableChannel" ) ; } }
Disable the input channel .