Interface ContextAwareTaskExecutor

All Superinterfaces:
Executor, TaskExecutor
All Known Subinterfaces:
ContextAwareTaskExecutorService, MonitorableTaskExecutor, MonitorableTaskExecutorService
All Known Implementing Classes:
ContextAwareWrapper, SingleThreadedExecutor, SyncTaskExecutor, ThreadPoolTaskExecutor

public interface ContextAwareTaskExecutor extends TaskExecutor
Defines a 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 CompletionStage, etc.
  • Method Details

    • isExecutingInThis

      boolean isExecutingInThis()
      Returns 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.

      Returns:
      true if the calling code is executing in the context of this executor, false otherwise