private long throttleQueries ( ) { if ( timeLastQuerySent != 0 ) { // check that we allowed some time between queries long difference = System . currentTimeMillis ( ) - timeLastQuerySent ; if ( difference < minDelayBetweenQueries ) { return minDelayBetweenQueries - difference ; } } return - 1 ; }
Returns the amount of time to wait if the backend was queried too recently and needs throttling or - 1 if the backend can be queried straight away .