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

org.jtrim2.executor.AbstractTaskExecutorService Maven / Gradle / Ivy

There is a newer version: 2.0.7
Show newest version
package org.jtrim2.executor;

import java.util.Objects;
import java.util.concurrent.CompletionStage;
import org.jtrim2.cancel.CancellationToken;

/**
 * Defines a convenient abstract base class for {@link TaskExecutorService}
 * implementations.
 * 

* {@code AbstractTaskExecutorService} extends {@code AbstractTaskExecutor} with * automatically canceling the task if the executor was shut down, so implementations * does not need to check for shut down. */ public abstract class AbstractTaskExecutorService extends AbstractTaskExecutor implements TaskExecutorService { /** * {@inheritDoc } */ @Override public CompletionStage executeFunction( CancellationToken cancelToken, CancelableFunction function) { Objects.requireNonNull(cancelToken, "cancelToken"); Objects.requireNonNull(function, "function"); if (isShutdown()) { return CancelableTasks.canceledComplationStage(); } return super.executeFunction(cancelToken, function); } }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy