java.util.concurrent.ThreadPoolExecutor 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.
package java.util.concurrent;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
public class ThreadPoolExecutor implements ExecutorService {
public ThreadPoolExecutor(int corePoolSize, int maximumPoolSize, long keepAliveTime, TimeUnit unit, BlockingQueue workQueue) {
}
public ThreadPoolExecutor(int corePoolSize, int maximumPoolSize, long keepAliveTime, TimeUnit unit, BlockingQueue workQueue, ThreadFactory threadFactory) {
}
public ThreadPoolExecutor(int corePoolSize, int maximumPoolSize, long keepAliveTime, TimeUnit unit, BlockingQueue workQueue, RejectedExecutionHandler handler) {
}
public ThreadPoolExecutor(int corePoolSize, int maximumPoolSize, long keepAliveTime, TimeUnit unit, BlockingQueue workQueue, ThreadFactory threadFactory, RejectedExecutionHandler handler) {
}
@Override
public void shutdown() {
}
@Override
public List shutdownNow() {
return new ArrayList<>();
}
@Override
public boolean isShutdown() {
return false;
}
@Override
public boolean isTerminated() {
return true;
}
@Override
public boolean awaitTermination(long timeout, TimeUnit unit) throws InterruptedException {
return true;
}
@Override
public Future submit(Callable task) {
try {
return new ImmediateFuture<>(task.call());
} catch (Exception e) {
return new ImmediateFuture<>(null);
}
}
@Override
public Future submit(Runnable task, T result) {
task.run();
return new ImmediateFuture<>(result);
}
@Override
public Future> submit(Runnable task) {
return submit(task, null);
}
@Override
public List> invokeAll(Collection extends Callable> tasks) throws InterruptedException {
ArrayList> out = new ArrayList<>();
for (Callable task : tasks) {
try {
out.add(new ImmediateFuture(task.call()));
} catch (Exception e) {
e.printStackTrace();
}
}
return out;
}
@Override
public List> invokeAll(Collection extends Callable> tasks, long timeout, TimeUnit unit) throws InterruptedException {
return invokeAll(tasks);
}
@Override
public T invokeAny(Collection extends Callable> tasks) throws InterruptedException, ExecutionException {
for (Callable task : tasks) {
try {
return task.call();
} catch (Exception e) {
e.printStackTrace();
}
}
return null;
}
@Override
public T invokeAny(Collection extends Callable> tasks, long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException {
return invokeAny(tasks);
}
@Override
public void execute(Runnable command) {
command.run();
}
}