public synchronized int checkExceptionThreshold(String queueid){
  FetchItemQueue fiq=queues.get(queueid);
  if (fiq == null) {
    return 0;
  }
  if (fiq.getQueueSize() == 0) {
    return 0;
  }
  int excCount=fiq.incrementExceptionCounter();
  if (maxExceptionsPerQueue != -1 && excCount >= maxExceptionsPerQueue) {
    int deleted=fiq.emptyQueue();
    LOG.info("* queue: " + queueid + " >> removed "+ deleted+ " URLs from queue because "+ excCount+ " exceptions occurred");
    for (int i=0; i < deleted; i++) {
      totalSize.decrementAndGet();
    }
    return deleted;
  }
  return 0;
}

public synchronized int checkExceptionThreshold ( String queueid ) { FetchItemQueue fiq = queues . get ( queueid ) ; if ( fiq == null ) { return 0 ; } if ( fiq . getQueueSize ( ) == 0 ) { return 0 ; } int excCount = fiq . incrementExceptionCounter ( ) ; if ( maxExceptionsPerQueue != - 1 && excCount >= maxExceptionsPerQueue ) { int deleted = fiq . emptyQueue ( ) ; LOG . info ( "* queue: " + queueid + " >> removed " + deleted + " URLs from queue because " + excCount + " exceptions occurred" ) ; for ( int i = 0 ; i < deleted ; i ++ ) { totalSize . decrementAndGet ( ) ; } return deleted ; } return 0 ; }
increment the exception counter of a queue in case of an exception e . g . timeout ; when higher than a given threshold simply empty the queue .
