Package io.kroxylicious.proxy.filter
Interface FilterDispatchExecutor
- All Superinterfaces:
AutoCloseable,Executor,ExecutorService,ScheduledExecutorService
An Executor backed by the Filter Dispatch Thread. That is the single thread associated with the Channel for
a Filter Instance. All invocations of that instance's methods are made by the Filter Dispatch Thread.
If all accesses/mutations of Filter Members happen on the Filter Dispatch Thread, then those interactions are serial and threadsafe. This executor enables Authors to do work in uncontrolled threads and then return to the Filter Dispatch Thread to take advantage of this convenient threading guarantee.
Note that implementations of FilterDispatchExecutor will not honour the shut-down methods ExecutorService.shutdown()
and ExecutorService.shutdownNow() and will throw a RuntimeException if those methods are called, as the client is
not allowed to shut down the Filter Dispatch Thread.
- See Also:
-
Method Summary
Modifier and TypeMethodDescription<T> CompletionStage<T> Switches to this Filter Dispatch Thread.booleanMethods inherited from interface java.util.concurrent.ExecutorService
awaitTermination, close, invokeAll, invokeAll, invokeAny, invokeAny, isShutdown, isTerminated, shutdown, shutdownNow, submit, submit, submitMethods inherited from interface java.util.concurrent.ScheduledExecutorService
schedule, schedule, scheduleAtFixedRate, scheduleWithFixedDelay
-
Method Details
-
isInFilterDispatchThread
boolean isInFilterDispatchThread()- Returns:
- Return true if
Thread.currentThread()is this Filter Dispatch Thread, false otherwise
-
completeOnFilterDispatchThread
Switches to this Filter Dispatch Thread. The CompletionStage returned is an implementation that discourages blocking work and will throw if the client attempts to callCompletionStage.toCompletableFuture(). Any async work chained onto the result CompletionStage using methods likeCompletionStage.thenApplyAsync(Function)will also be executed on the Filter Dispatch Thread.- Type Parameters:
T- stage value type- Parameters:
stage- input stage- Returns:
- a stage completed (both exceptionally and normally) by this Filter Dispatch Thread
-