private boolean disableChannelInChain ( Channel targetChannel , Chain chain ) throws ChannelException , ChainException { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { Tr . entry ( tc , "disableChannelInChain" ) ; } String channelName = targetChannel . getName ( ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "channelName=" + channelName + " chainName=" + chain . getName ( ) ) ; } ChannelContainer channelContainer = channelRunningMap . get ( channelName ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Found channel, state: " + channelContainer . getState ( ) . ordinal ) ; } Channel channel = channelContainer . getChannel ( ) ; RuntimeState chainState = null ; boolean stillInUse = false ; for ( Chain channelChain : channelContainer . getChainMap ( ) . values ( ) ) { chainState = channelChain . getState ( ) ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Found chain reference: " + channelChain . getName ( ) + ", state: " + chainState . ordinal ) ; } if ( channelChain . getName ( ) . equals ( chain . getName ( ) ) ) { // Don't analyze this channel. It is either in STARTED or QUIESCED // state. continue ; } else if ( ( RuntimeState . STARTED == chainState ) || ( RuntimeState . QUIESCED == chainState ) ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Found chain that is not ready to stop, " + channelChain . getName ( ) ) ; } stillInUse = true ; break ; } } // Check to ensure that no other chains will be broken. if ( ! stillInUse ) { // Disable the channel from handling any more connections in the chain. if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Disabling channel, " + channelName ) ; } ( ( InboundChain ) chain ) . disableChannel ( channel ) ; } else if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Skip channel stop, in use by other chain(s)" ) ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) { Tr . exit ( tc , "disableChannelInChain" ) ; } return ! stillInUse ; }
This method is done in preparation for stopping a channel . It pull s its discriminator from the device side channel s discrimination process in the chain .