Answers for "how to add timeout java"

0

java timeout

ScheduledExecutorService executor = Executors.newScheduledThreadPool(2); 
 final Future handler = executor.submit(new Callable(){ ... });
 executor.schedule(new Runnable(){
     public void run(){
         handler.cancel();
     }      
 }, 10000, TimeUnit.MILLISECONDS);
Posted by: Guest on February-03-2022

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language