Package io.smallrye.faulttolerance.api
Interface Guard.Builder.BulkheadBuilder
- Enclosing interface:
Guard.Builder
public static interface Guard.Builder.BulkheadBuilder
Configures a bulkhead.
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptiondone()Returns the original fault tolerance builder.Enables bulkhead queueing for synchronous actions.limit(int value) Sets the concurrency limit the bulkhead will enforce.onAccepted(Runnable callback) Sets a callback that will be invoked when this bulkhead accepts an invocation.onFinished(Runnable callback) Sets a callback that will be invoked when a finished invocation leaves this bulkhead.onRejected(Runnable callback) Sets a callback that will be invoked when this bulkhead rejects an invocation.queueSize(int value) Sets the maximum size of the bulkhead queue.default Guard.Builder.BulkheadBuilderwith(Consumer<Guard.Builder.BulkheadBuilder> consumer)
-
Method Details
-
limit
Sets the concurrency limit the bulkhead will enforce. Defaults to 10.- Parameters:
value- the concurrency limit, must be >= 1- Returns:
- this bulkhead builder
- See Also:
-
queueSize
Sets the maximum size of the bulkhead queue. Defaults to 10.- Parameters:
value- the queue size, must be >= 1- Returns:
- this bulkhead builder
- See Also:
-
enableSynchronousQueueing
Guard.Builder.BulkheadBuilder enableSynchronousQueueing()Enables bulkhead queueing for synchronous actions.If you use this method, you have to ensure that the guard is executed on a virtual thread.
- Returns:
- this bulkhead builder
-
onAccepted
Sets a callback that will be invoked when this bulkhead accepts an invocation. In case of asynchronous actions, accepting into bulkhead doesn't mean the action is immediately invoked; the invocation is first put into a queue and may wait there.The callback must be fast and non-blocking and must not throw an exception.
- Parameters:
callback- the accepted callback, must not benull- Returns:
- this bulkhead builder
-
onRejected
Sets a callback that will be invoked when this bulkhead rejects an invocation.The callback must be fast and non-blocking and must not throw an exception.
- Parameters:
callback- the rejected callback, must not benull- Returns:
- this bulkhead builder
-
onFinished
Sets a callback that will be invoked when a finished invocation leaves this bulkhead.The callback must be fast and non-blocking and must not throw an exception.
- Parameters:
callback- the finished callback, must not benull- Returns:
- this bulkhead builder
-
done
Guard.Builder done()Returns the original fault tolerance builder.- Returns:
- the original fault tolerance builder
-
with
-