private int calculateBatchSize ( ) { Integer batchSize = mongoIterable . getBatchSize ( ) ; if ( batchSize != null ) { return batchSize ; } long requested = getRequested ( ) ; if ( requested <= 1 ) { return 2 ; } else if ( requested < Integer . MAX_VALUE ) { return ( int ) requested ; } else { return Integer . MAX_VALUE ; } }
Returns the batchSize to be used with the cursor .