public synchronized int chooseGetCursorIndex ( int previous ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( tc , "chooseGetCursorIndex" , new Object [ ] { Integer . valueOf ( previous ) } ) ; // The zeroth index represents the default cursor for non-classified messages. int classPos = 0 ; if ( classifications . getNumberOfClasses ( ) > 0 ) { // Need to determine the class of message to process if ( previous == - 1 ) { // First time through, get the initial weightings table weightMap = classifications . getWeightings ( ) ; } else { // Need to remove previous entries from the weightMap weightMap . remove ( Integer . valueOf ( previous ) ) ; } if ( ! weightMap . isEmpty ( ) ) { classPos = classifications . findClassIndex ( weightMap ) ; } // eof non-empty weightmap else if ( unitTestOperation ) { // In a production environment we'd return zero in this case so that the // default cursor would be used. In a Unit test environment, where we are // classifying messages and where we have configured the test so that a // cursor associated with a specific classification should be used then // we'll alert the test to an error by throwing this exception. if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "chooseGetCursorIndex" , "SIErrorException" ) ; throw new SIErrorException ( ) ; } } if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( tc , "chooseGetCursorIndex" , classPos ) ; return classPos ; }
Determine the index of the getCursor to use based on the classifications defined for the ConsumerSet that this consumer belongs to .