java.util.concurrent.FutureTask Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jtransc-rt Show documentation
Show all versions of jtransc-rt Show documentation
JVM AOT compiler currently generating JavaScript, C++, Haxe, with initial focus on Kotlin and games.
The newest version!
package java.util.concurrent;
public class FutureTask implements RunnableFuture {
private V result;
public FutureTask(Callable callable) {
try {
result = callable.call();
} catch (Exception e) {
e.printStackTrace();
result = null;
}
}
public FutureTask(Runnable runnable, V result) {
runnable.run();
this.result = result;
}
@Override
public void run() {
// @TODO: Should call exeuction here instead of the constructor?
}
@Override
public boolean cancel(boolean mayInterruptIfRunning) {
return false;
}
@Override
public boolean isCancelled() {
return false;
}
@Override
public boolean isDone() {
return true;
}
@Override
public V get() throws InterruptedException, ExecutionException {
return result;
}
@Override
public V get(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException {
return get();
}
}