public boolean isValidStreamId ( Number streamId ) { double d = streamId . doubleValue ( ) ; if ( log . isTraceEnabled ( ) ) { log . trace ( "Checking validation for streamId {}; reservedStreams: {}; streams: {}, connection: {}" , new Object [ ] { d , reservedStreams , streams , sessionId } ) ; } if ( d <= 0 || ! reservedStreams . contains ( d ) ) { log . warn ( "Stream id: {} was not reserved in connection {}" , d , sessionId ) ; // stream id has not been reserved before return false ; } if ( streams . get ( d ) != null ) { // another stream already exists with this id log . warn ( "Another stream already exists with this id in streams {} in connection: {}" , streams , sessionId ) ; return false ; } if ( log . isTraceEnabled ( ) ) { log . trace ( "Stream id: {} is valid for connection: {}" , d , sessionId ) ; } return true ; }
Returns whether or not a given stream id is valid .