Class NonBlockingMutexExecutor

java.lang.Object
graphql.execution.reactive.NonBlockingMutexExecutor
All Implemented Interfaces:
Executor

class NonBlockingMutexExecutor extends Object implements Executor
Executor that provides mutual exclusion between the operations submitted to it, without blocking. If an operation is submitted to this executor while no other operation is running, it will run immediately. If an operation is submitted to this executor while another operation is running, it will be added to a queue of operations to run, and the executor will return. The thread currently running an operation will end up running the operation just submitted. Operations submitted to this executor should run fast, as they can end up running on other threads and interfere with the operation of other threads. This executor can also be used to address infinite recursion problems, as operations submitted recursively will run sequentially. Inspired by Public Domain CC0 code at h https://github.com/jroper/reactive-streams-servlet/tree/master/reactive-streams-servlet/src/main/java/org/reactivestreams/servlet