io.atlassian.util.concurrent.ExecutorSubmitter Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of atlassian-util-concurrent Show documentation
Show all versions of atlassian-util-concurrent Show documentation
This project contains utility classes that are used by
various products and projects inside Atlassian and may have some
utility to the world at large.
package io.atlassian.util.concurrent;
import java.util.concurrent.Callable;
import java.util.concurrent.Executor;
import java.util.concurrent.Future;
import java.util.concurrent.RejectedExecutionException;
import java.util.function.Supplier;
/**
* Adds the {@link java.util.concurrent.ExecutorService} job submission methods
* without exposing the life-cycle management API. Is tweaked to return
* {@link Promise promises} rather than anemic {@link Future futures}.
*
* @since 2.6.2
*/
public interface ExecutorSubmitter extends Executor {
/**
* Submits a value-returning task for execution and returns a Promise
* representing the pending results of the task.
*
* @param task the task to submit
* @return a Promise representing pending completion of the task
* @throws RejectedExecutionException if the task cannot be scheduled for
* execution
* @throws java.lang.NullPointerException if the task is null
* @param a T to return.
*/
Promise submit(Callable task);
/**
* Submits a value-returning task for execution and returns a Promise
* representing the pending results of the task.
*
* @param task the task to submit
* @return a Promise representing pending completion of the task
* @throws RejectedExecutionException if the task cannot be scheduled for
* execution
* @throws java.lang.NullPointerException if the task is null
* @param a T to return.
*/
Promise submitSupplier(Supplier task);
}