private void fetchIfNeeded ( long remainingBytes ) { if ( ( fetchFutures . isEmpty ( ) || fetchFutures . peekLast ( ) . isDone ( ) ) && remainingBytes <= prefetchConfig . getPrefetchTriggerBytes ( ) ) { Future < Void > fetchFuture = fetchExecutor . submit ( ( ) -> { fetch ( ) ; return null ; } ) ; fetchFutures . add ( fetchFuture ) ; } }
Submit a fetch task if remainingBytes is smaller than prefetchTriggerBytes .