org.jtrim2.executor.ContextAwareTaskExecutor Maven / Gradle / Ivy
package org.jtrim2.executor;
/**
* Defines a {@link TaskExecutor} which is able to decide whether the currently
* running code is executing in the context of the executor or not.
*
* Thread safety
* Implementations of this interface are required to be safely accessible from
* multiple threads concurrently.
*
* Synchronization transparency
* The methods of this interface are not required to be
* synchronization transparent because they may execute tasks, handlers added
* to {@code CompletionStage}, etc.
*/
public interface ContextAwareTaskExecutor extends TaskExecutor {
/**
* Returns {@code true} if the calling code is executing in the context of
* this executor. That is, it is executed by a task submitted to this
* executor.
*
* This method can be used to check that a method call is executing in the
* context it was designed for.
*
* @return {@code true} if the calling code is executing in the context of
* this executor, {@code false} otherwise
*/
public boolean isExecutingInThis();
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy