private boolean reduceFetchSize ( Throwable reason ) { if ( ! isAdaptiveException ( reason ) || -- _remainingAdaptations == 0 ) { return false ; } ExecutionInfo executionInfo = _delegate . getExecutionInfo ( ) ; Statement statement = executionInfo . getStatement ( ) ; PagingState pagingState = executionInfo . getPagingState ( ) ; int fetchSize = statement . getFetchSize ( ) ; while ( fetchSize > MIN_FETCH_SIZE ) { fetchSize = Math . max ( fetchSize / 2 , MIN_FETCH_SIZE ) ; _log . debug ( "Retrying query at next page with fetch size {} due to {}" , fetchSize , reason . getMessage ( ) ) ; statement . setFetchSize ( fetchSize ) ; statement . setPagingState ( pagingState ) ; try { _delegate = _session . execute ( statement ) ; return true ; } catch ( Throwable t ) { // Exit the adaptation loop if the exception isn't one where adapting further may help if ( ! isAdaptiveException ( t ) || -- _remainingAdaptations == 0 ) { return false ; } } } return false ; }
Reduces the fetch size and retries the query . Returns true if the query succeeded false if the root cause of the exception does not indicate a frame size issue if the frame size cannot be adjusted down any further or if the retried query fails for an unrelated reason .