net.corda.node.utilities / AffinityExecutor / Gate / <init>

# <init>

`Gate(alwaysQueue: Boolean = false)`

An executor useful for unit tests: allows the current thread to block until a command arrives from another thread, which is then executed. Inbound closures/commands stack up until they are cleared by looping.

### Parameters

`alwaysQueue` - If true, executeASAP will never short-circuit and will always queue up.