Code example for ListeningExecutorService

Methods: submit

0
 
    Preconditions.checkNotNull(emailAddress, "'emailAddress' must be present");
 
    final String cleanEmailAddress = emailAddress.toLowerCase().trim();
 
    return gravatarExecutorService.submit(new Callable<Optional<BufferedImage>>() {
 
      @Override 
      public Optional<BufferedImage> call() throws Exception {
        return cache.get(cleanEmailAddress);
      } 
    }); 
 
  } 
 
  /** 
   * @param emailAddress The cleaned email address to use as an MD5 lookup 
   * 
   * @return The buffered image if present 
   */