List of utility methods to do Thread Future
V | getSilently(Future get Silently boolean interrupted = false; try { while (true) { try { return future.get(); } catch (InterruptedException e) { interrupted = true; } catch (Throwable ignored) { return null; } finally { if (interrupted) { Thread.currentThread().interrupt(); |
List | getSysExeNameList() get Sys Exe Name List if (loaded) return sysExeNameList; try { if (ft.get().equals("ok")) { loaded = true; return sysExeNameList; } catch (Exception e) { ... |
T | getUninterruptibly(Future get Uninterruptibly return getUninterruptibly(future, RuntimeException.class, RuntimeException.class, RuntimeException.class, RuntimeException.class); |
Future | invokeTask(String threadName, Callable invoke Task FutureTask<T> task = new FutureTask<T>(callable); Thread t = new Thread(task); t.setName(threadName); t.start(); return task; |
boolean | isSuccessful(CompletableFuture Returns true if the future is done and successful. return f.isDone() && !f.isCompletedExceptionally() && !f.isCancelled();
|
long | nanoTime() Returns the current value of the most precise available system timer, in nanoseconds. return System.nanoTime();
|
Collection | now(Collection now Set<Integer> res = new HashSet<Integer>(); for (Future<Integer> r : s) res.add(r.get()); return res; |
Future | rollback(Object tx) rollback return null;
|
T | runIfNotDoneAndGet(RunnableFuture run If Not Done And Get if (null == future) { return null; if (!future.isDone()) { future.run(); return future.get(); |
void | runInNewThread(String threadName, Runnable target) run In New Thread FutureTask<Object> future = new FutureTask<Object>(target, null); new Thread(future, threadName).start(); try { future.get(); } catch (ExecutionException e) { throw e.getCause(); |