Java Thread Future getSilently(Future future)

Here you can find the source of getSilently(Future future)

Description

get Silently

License

Open Source License

Declaration

public static <V> V getSilently(Future<V> future) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.util.concurrent.Future;

public class Main {
    public static <V> V getSilently(Future<V> future) {
        boolean interrupted = false;
        try {/*w  w  w  .  j a  va 2s  .c  o m*/
            while (true) {
                try {
                    return future.get();
                } catch (InterruptedException e) {
                    interrupted = true;
                }
            }
        } catch (Throwable ignored) {
            return null;
        } finally {
            if (interrupted) {
                Thread.currentThread().interrupt();
            }
        }
    }
}

Related

  1. getExceptionFromNewThread(String threadName, Runnable target)
  2. getFailedFuture(Throwable throwable)
  3. getFuture(Future future, String message)
  4. getMinIn(Map> responses)
  5. getResults(Iterable> futures)
  6. getSysExeNameList()
  7. getUninterruptibly(Future future)
  8. invokeTask(String threadName, Callable callable)
  9. isSuccessful(CompletableFuture f)