Dispatcher Bulkhead
Isolation-by-dispatcher bulkhead: like Bulkhead, but every admitted call runs on a dedicated CoroutineDispatcher instead of the caller's context.
A semaphore-only Bulkhead bounds concurrency but a slow/blocking call still occupies the caller's threads. Running the protected work on its own dispatcher (e.g. a fixed thread pool, see ThreadPoolBulkhead on the JVM) keeps a slow dependency from starving the rest of the application.
val bulkhead = DispatcherBulkhead.create(Dispatchers.IO.limitedParallelism(4))
bulkhead.execute { blockingCall() }Content copied to clipboard
Types
Link copied to clipboard
object Companion
Factory for DispatcherBulkhead.
Properties
Functions
Link copied to clipboard
Returns the current number of active calls.
Link copied to clipboard
Adds a listener for bulkhead events.
Link copied to clipboard
Link copied to clipboard
Resets all statistics counters.
Link copied to clipboard
Returns a snapshot of the current statistics.
Link copied to clipboard
Like execute but returns null when rejected.
Inherited functions
Link copied to clipboard
Adapts this DispatcherBulkhead into a Policy.