Java Utililty Methods Thread Future

List of utility methods to do Thread Future

Description

The list of methods to do Thread Future are organized into topic(s).

Method

VgetSilently(Future 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();
ListgetSysExeNameList()
get Sys Exe Name List
if (loaded)
    return sysExeNameList;
try {
    if (ft.get().equals("ok")) {
        loaded = true;
        return sysExeNameList;
} catch (Exception e) {
...
TgetUninterruptibly(Future future)
get Uninterruptibly
return getUninterruptibly(future, RuntimeException.class, RuntimeException.class, RuntimeException.class,
        RuntimeException.class);
FutureinvokeTask(String threadName, Callable callable)
invoke Task
FutureTask<T> task = new FutureTask<T>(callable);
Thread t = new Thread(task);
t.setName(threadName);
t.start();
return task;
booleanisSuccessful(CompletableFuture f)
Returns true if the future is done and successful.
return f.isDone() && !f.isCompletedExceptionally() && !f.isCancelled();
longnanoTime()
Returns the current value of the most precise available system timer, in nanoseconds.
return System.nanoTime();
Collectionnow(Collection> s)
now
Set<Integer> res = new HashSet<Integer>();
for (Future<Integer> r : s)
    res.add(r.get());
return res;
Futurerollback(Object tx)
rollback
return null;
TrunIfNotDoneAndGet(RunnableFuture future)
run If Not Done And Get
if (null == future) {
    return null;
if (!future.isDone()) {
    future.run();
return future.get();
voidrunInNewThread(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();