private final void tryPrefetching ( ) throws SIResourceException { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . entry ( this , tc , "tryPrefetching" ) ; int toPrefetchCount = 0 ; // count of gets to issue synchronized ( this ) { if ( ! detached ) { int count = countOfOutstandingInfiniteTimeoutGets + countOfUnlockedMessages ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( tc , "readAhead check: count(" + count + ") prefetchWindowSize(" + prefetchWindowSize + ")" ) ; if ( count < prefetchWindowSize ) // note that it is possible that count > prefetchWindowSize { // perhaps we should prefetch if ( ( ( prefetchWindowSize - count ) / ( double ) prefetchWindowSize ) > SIMPConstants . MIN_PREFETCH_SIZE ) { toPrefetchCount = prefetchWindowSize - count ; countOfOutstandingInfiniteTimeoutGets += toPrefetchCount ; if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( tc , "readAhead change: countOfOutstandingInfiniteTimeoutGets+= " + countOfOutstandingInfiniteTimeoutGets ) ; } } } } if ( toPrefetchCount > 0 ) { if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( tc , "readAhead change: toPrefetchCount " + toPrefetchCount ) ; AIStreamKey [ ] keys = rcd . issueGet ( criteria , toPrefetchCount , this ) ; int i ; if ( keys == null ) i = 0 ; else i = keys . length ; if ( i < toPrefetchCount ) { // this will be very rare! // decrement the counts. synchronized ( this ) { countOfOutstandingInfiniteTimeoutGets -= ( toPrefetchCount - i ) ; // the first i gets were successful if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isDebugEnabled ( ) ) SibTr . debug ( tc , "readAhead change: countOfOutstandingInfiniteTimeoutGets-= " + countOfOutstandingInfiniteTimeoutGets ) ; } // log and throw exception to consumer SIResourceException e = new SIResourceException ( nls . getFormattedMessage ( "ANYCAST_STREAM_UNAVAILABLE_CWSIP0481" , new Object [ ] { rcd . getDestName ( ) , rcd . getLocalisationUuid ( ) . toString ( ) } , null ) ) ; FFDCFilter . processException ( e , "com.ibm.ws.sib.processor.impl.RemoteQPConsumerKey.tryPrefetching" , "1:755:1.47.1.26" , this ) ; SibTr . exception ( tc , e ) ; consumerPoint . notifyException ( e ) ; } } // end if (toPrefetchCount > 0) if ( TraceComponent . isAnyTracingEnabled ( ) && tc . isEntryEnabled ( ) ) SibTr . exit ( this , tc , "tryPrefetching" ) ; }
Internal method . See if we need to prefetch more messages and if yes do the prefetch