fitnesse.util.SerialExecutorService Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of fitnesse Show documentation
Show all versions of fitnesse Show documentation
The fully integrated standalone wiki, and acceptance testing framework.
package fitnesse.util;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.concurrent.Callable;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
import org.apache.commons.lang.NotImplementedException;
/**
* This implementation of {@link java.util.concurrent.ExecutorService} is a dummy/debug version of an execution
* service. The tasks are executed instantly, in the current execution thread.
*/
public class SerialExecutorService implements ExecutorService {
@Override
public Future submit(Callable task) {
try {
return new FutureIsNow<>(task.call());
} catch (Exception e) {
return new FutureIsNow<>(e);
}
}
@Override
public Future submit(Runnable task, T result) {
task.run();
return new FutureIsNow<>(result);
}
@Override
public Future> submit(Runnable task) {
task.run();
return new FutureIsNow