Guava SimpleTimeLimiter - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Guava SimpleTimeLimiter class.

This code example shows how to use the following methods:callWithTimeout
            String command) {
        log.info("=== about to call ===\n{}", command);
        final List<String> commands =
                Lists.newArrayList(Splitter.on(" ").split(command));
 
        SimpleTimeLimiter timeLimiter = new SimpleTimeLimiter();
        Callable<List<String>> work = new Callable<List<String>>() {
            @Override 
            public List<String> call() throws Exception {
                Process process = 
                        ClientWorkFlow.invokeClient(workingDirectory,
                                commands);
                process.waitFor(); 
                List<String> output = ClientWorkFlow.getOutput(process);
                logOutputLines(output);
                return output;
            } 
        }; 
        try { 
            return timeLimiter

6
CodeRank
This code example shows how to use the following methods:newProxy
    } 
 
    private static <T> T timeLimited(T target, Class<T> clazz, Duration timeout, ExecutorService executor, int maxThreads)
    { 
        executor = new ExecutorServiceAdapter(new BoundedExecutor(executor, maxThreads));
        TimeLimiter limiter = new SimpleTimeLimiter(executor);
        return limiter.newProxy(target, clazz, timeout.toMillis(), MILLISECONDS);
    } 
} 
5
CodeRank
This code example shows how to use the following methods:
      } 
 
      @Provides 
      @Singleton 
      TimeLimiter timeLimiter(@Named(PROPERTY_USER_THREADS) ListeningExecutorService userExecutor){ 
         return new SimpleTimeLimiter(userExecutor); 
      } 
   } 
 
   protected void assertPayloadEquals(HttpRequest request, String toMatch, String contentType, boolean contentMD5) { 
      assertPayloadEquals(request, toMatch, contentType, contentMD5, null); 
   } 
 
   protected void assertPayloadEquals(HttpRequest request, String toMatch, String contentType, boolean contentMD5, Date expires) { 
      assertPayloadEquals(request, toMatch, contentType, null, null, null, contentMD5, expires); 
   } 
 
   protected void assertPayloadEquals(HttpRequest request, String toMatch, String contentType, 
         String contentDispositon, String contentEncoding, String contentLanguage, boolean contentMD5) { 
      assertPayloadEquals(request, toMatch, contentType, contentDispositon, contentEncoding, contentLanguage,  
5
CodeRank
See Code Examples for Guava SimpleTimeLimiter Methods: