java settimeout code example
Example 1: settimeout jquery
setTimeout(function(){ alert("Hello"); }, 3000);
Example 2: java setter
public setValue(value) {
this.value = value;
}
Example 3: timeout java
ExecutorService executor=Executors.newSingleThreadExecutor();
Future<ReturnType> future=executor.submit(task);
try{
ReturnType result=future.get(1,TimeUnit.SECONDS);
}catch(TimeoutException e){
future.cancel(true);
}catch(InterruptedException e){
Thread.currentThread().interrupt();
}catch(ExecutionException e){
throw e.getCause();
}