All Downloads are FREE. Search and download functionalities are using the official Maven repository.

java.util.concurrent.ThreadPoolExecutor Maven / Gradle / Ivy

Go to download

JVM AOT compiler currently generating JavaScript, C++, Haxe, with initial focus on Kotlin and games.

There is a newer version: 0.6.8
Show newest version
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> 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> tasks, long timeout, TimeUnit unit) throws InterruptedException {
		return invokeAll(tasks);
	}

	@Override
	public  T invokeAny(Collection> tasks) throws InterruptedException, ExecutionException {
		for (Callable task : tasks) {
			try {
				return task.call();
			} catch (Exception e) {
				e.printStackTrace();
			}
		}
		return null;
	}

	@Override
	public  T invokeAny(Collection> tasks, long timeout, TimeUnit unit) throws InterruptedException, ExecutionException, TimeoutException {
		return invokeAny(tasks);
	}

	@Override
	public void execute(Runnable command) {
		command.run();
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy