@ Override public void addDiscriminator ( Discriminator d , int weight ) throws DiscriminationProcessException { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "addDiscriminator: " + d + " weight=" + weight ) ; } if ( status == STARTED ) { DiscriminationProcessException e = new DiscriminationProcessException ( "Should not add to DiscriminationGroup while started!" ) ; FFDCFilter . processException ( e , getClass ( ) . getName ( ) + ".addDiscriminator" , "239" , this , new Object [ ] { d } ) ; throw e ; } if ( weight < 0 ) { DiscriminationProcessException e = new DiscriminationProcessException ( "Invalid weight for discriminator, " + weight ) ; FFDCFilter . processException ( e , getClass ( ) . getName ( ) + ".addDiscriminator" , "260" , this , new Object [ ] { Long . valueOf ( weight ) } ) ; throw e ; } if ( ! discAL . contains ( d ) ) { if ( d . getDiscriminatoryDataType ( ) . isAssignableFrom ( discriminantClass ) ) { if ( d . getChannel ( ) == null || d . getChannel ( ) . getName ( ) == null ) { DiscriminationProcessException e = new DiscriminationProcessException ( "Discriminator does not have channel or its channel has no name" ) ; FFDCFilter . processException ( e , getClass ( ) . getName ( ) + ".addDiscriminator" , "273" , this , new Object [ ] { d } ) ; throw e ; } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Add discriminator " + d . getChannel ( ) . getName ( ) ) ; } addDiscriminatorNode ( new DiscriminatorNode ( d , weight ) ) ; discAL . add ( d ) ; Channel chan = d . getChannel ( ) ; addChannel ( chan ) ; this . changed = true ; } else { ClassCastException e = new ClassCastException ( ) ; FFDCFilter . processException ( e , getClass ( ) . getName ( ) + ".addDiscriminator" , "292" , this , new Object [ ] { d } ) ; throw e ; } } else { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) { Tr . debug ( tc , "Same discriminator added twice?" ) ; } } }
Adds a discriminator to the group . Attempts to add the same discriminator more than once are ignored . It is an error to attempt to add a discriminator which is not able to deal with the groups type of discriminatory data . A class cast exception is thrown if this is attempted .