public void submitOne(final R resource,final long retryMillis) throws InterruptedException, Exception {
  if (resource == null)   throw new IllegalArgumentException();
  if (retryMillis < 0)   throw new IllegalArgumentException();
  int retryCount=0;
  final long begin=System.currentTimeMillis();
  long lastLogTime=begin;
  final Callable<?> task=newParserTask(resource);
  while (true) {
    try {
      submitOne(resource,task);
      return;
    }
 catch (    RejectedExecutionException ex) {
      if (parserService.isShutdown()) {
        throw ex;
      }
      if (retryMillis == 0L) {
        throw ex;
      }
      Thread.sleep(retryMillis);
      retryCount++;
      if (log.isInfoEnabled()) {
        final long now=System.currentTimeMillis();
        final long elapsedSinceLastLogTime=now - lastLogTime;
        if (elapsedSinceLastLogTime > 5000) {
          final long elapsed=now - begin;
          lastLogTime=now;
          log.info("Parser pool blocking: retryCount=" + retryCount + ", elapsed="+ elapsed+ "ms, resource="+ resource);
        }
      }
      continue;
    }
catch (    InterruptedException ex) {
      throw ex;
    }
catch (    Exception ex) {
      log.error(resource,ex);
    }
  }
}

public void submitOne ( final R resource , final long retryMillis ) throws InterruptedException , Exception { if ( resource == null ) throw new IllegalArgumentException ( ) ; if ( retryMillis < 0 ) throw new IllegalArgumentException ( ) ; int retryCount = 0 ; final long begin = System . currentTimeMillis ( ) ; long lastLogTime = begin ; final Callable < ? > task = newParserTask ( resource ) ; while ( true ) { try { submitOne ( resource , task ) ; return ; } catch ( RejectedExecutionException ex ) { if ( parserService . isShutdown ( ) ) { throw ex ; } if ( retryMillis == 0L ) { throw ex ; } Thread . sleep ( retryMillis ) ; retryCount ++ ; if ( log . isInfoEnabled ( ) ) { final long now = System . currentTimeMillis ( ) ; final long elapsedSinceLastLogTime = now - lastLogTime ; if ( elapsedSinceLastLogTime > 5000 ) { final long elapsed = now - begin ; lastLogTime = now ; log . info ( "Parser pool blocking: retryCount=" + retryCount + ", elapsed=" + elapsed + "ms, resource=" + resource ) ; } } continue ; } catch ( InterruptedException ex ) { throw ex ; } catch ( Exception ex ) { log . error ( resource , ex ) ; } } }
submit a resource for processing .
