public synchronized void destroyChainInternal ( Chain chain ) throws ChannelException , ChainException { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "destroyChainInternal: " + chain . getName ( ) ) ; } if ( RuntimeState . INITIALIZED . equals ( chain . getState ( ) ) ) { Channel [ ] chainChannels = chain . getChannels ( ) ; ChannelData [ ] channelData = chain . getChannelsData ( ) ; for ( int i = 0 ; i < chainChannels . length ; i ++ ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Destroy channel in chain: " + chainChannels [ i ] . getName ( ) ) ; } try { // Don't let one channel's exception mess up the whole chain. destroyChannelInChain ( chainChannels [ i ] , chain , channelData [ i ] ) ; } catch ( Exception e ) { FFDCFilter . processException ( e , getClass ( ) . getName ( ) + ".destroyChainInternal" , "2865" , this , new Object [ ] { chain , channelData [ i ] } ) ; Tr . error ( tc , "chain.destroy.error" , new Object [ ] { chain . getName ( ) , e . toString ( ) } ) ; } } chain . destroy ( ) ; // Remove the chain from the framework. this . chainRunningMap . remove ( chain . getName ( ) ) ; // Clear out the outbound VCF if this is outbound - called internally // only. if ( FlowType . OUTBOUND . equals ( chain . getChainData ( ) . getType ( ) ) ) { this . outboundVCFactories . remove ( chain . getName ( ) ) ; } } else { InvalidRuntimeStateException e = new InvalidRuntimeStateException ( "Unable to destroy chain: " + chain . getName ( ) + ", state: " + chain . getState ( ) . ordinal ) ; //Race condition can occur where chain is stopped before we register the listener, no need to FFDC //FFDCFilter.processException(e, getClass().getName() + ".destroyChainInternal", "2861", this, new Object[] { chain, this }); throw e ; } }
This method destroys both inbound and outbound chains ..