private ScanResult scan(ScanRequest scanRequest) {
        m_logger.debug("Performing scan() request on table {}", scanRequest.getTableName());
        
        Timer timer = new Timer();
        boolean bSuccess = false;
        ScanResult scanResult = null;
        for (int attempts = 1; !bSuccess; attempts++) {
            try {
                scanResult = m_ddbClient.scan(scanRequest);
                if (attempts > 1) {
                    m_logger.info("scan() succeeded on attempt #{}", attempts);
                }
                bSuccess = true;
                m_logger.debug("Time to scan table {}: {}", scanRequest.getTableName(), timer.toString());
            } catch (ProvisionedThroughputExceededException e) {
                if (attempts >= m_max_read_attempts) {
                    String errMsg = "All retries exceeded; abandoning scan() for table: " + scanRequest.getTableName();
                    m_logger.error(errMsg, e);
                    throw new RuntimeException(errMsg, e);
                }
                m_logger.warn("scan() attempt #{} failed: {}", attempts, e);
                try {
                    Thread.sleep(attempts * m_retry_wait_millis);
                } catch (InterruptedException ex2) {
                    // ignore
                }
            }
        }
        return scanResult;
    }
private ScanResult scan ( ScanRequest scanRequest ) { m_logger . debug ( "Performing scan() request on table {}" , scanRequest . getTableName ( ) ) ; Timer timer = new Timer ( ) ; boolean bSuccess = false ; ScanResult scanResult = null ; for ( int attempts = 1 ; ! bSuccess ; attempts ++ ) { try { scanResult = m_ddbClient . scan ( scanRequest ) ; if ( attempts > 1 ) { m_logger . info ( "scan() succeeded on attempt #{}" , attempts ) ; } bSuccess = true ; m_logger . debug ( "Time to scan table {}: {}" , scanRequest . getTableName ( ) , timer . toString ( ) ) ; } catch ( ProvisionedThroughputExceededException e ) { if ( attempts >= m_max_read_attempts ) { String errMsg = "All retries exceeded; abandoning scan() for table: " + scanRequest . getTableName ( ) ; m_logger . error ( errMsg , e ) ; throw new RuntimeException ( errMsg , e ) ; } m_logger . warn ( "scan() attempt #{} failed: {}" , attempts , e ) ; try { Thread . sleep ( attempts * m_retry_wait_millis ) ; } catch ( InterruptedException ex2 ) { } } } return scanResult ; }
Perform a scan request and retry if ProvisionedThroughputExceededException occurs.