@@ -4,7 +4,6 @@ namespace Polly.Bulkhead;
44/// <summary>
55/// A bulkhead-isolation policy which can be applied to delegates.
66/// </summary>
7- #pragma warning disable CA1062 // Validate arguments of public methods
87public class BulkheadPolicy : Policy , IBulkheadPolicy
98{
109 private readonly SemaphoreSlim _maxParallelizationSemaphore ;
@@ -25,8 +24,21 @@ internal BulkheadPolicy(
2524
2625 /// <inheritdoc/>
2726 [ DebuggerStepThrough ]
28- protected override TResult Implementation < TResult > ( Func < Context , CancellationToken , TResult > action , Context context , CancellationToken cancellationToken ) =>
29- BulkheadEngine . Implementation ( action , context , _onBulkheadRejected , _maxParallelizationSemaphore , _maxQueuedActionsSemaphore , cancellationToken ) ;
27+ protected override TResult Implementation < TResult > ( Func < Context , CancellationToken , TResult > action , Context context , CancellationToken cancellationToken )
28+ {
29+ if ( action is null )
30+ {
31+ throw new ArgumentNullException ( nameof ( action ) ) ;
32+ }
33+
34+ return BulkheadEngine . Implementation (
35+ action ,
36+ context ,
37+ _onBulkheadRejected ,
38+ _maxParallelizationSemaphore ,
39+ _maxQueuedActionsSemaphore ,
40+ cancellationToken ) ;
41+ }
3042
3143 /// <summary>
3244 /// Gets the number of slots currently available for executing actions through the bulkhead.
@@ -73,8 +85,20 @@ internal BulkheadPolicy(
7385
7486 /// <inheritdoc/>
7587 [ DebuggerStepThrough ]
76- protected override TResult Implementation ( Func < Context , CancellationToken , TResult > action , Context context , CancellationToken cancellationToken ) =>
77- BulkheadEngine . Implementation ( action , context , _onBulkheadRejected , _maxParallelizationSemaphore , _maxQueuedActionsSemaphore , cancellationToken ) ;
88+ protected override TResult Implementation ( Func < Context , CancellationToken , TResult > action , Context context , CancellationToken cancellationToken )
89+ {
90+ if ( action is null )
91+ {
92+ throw new ArgumentNullException ( nameof ( action ) ) ;
93+ }
94+
95+ return BulkheadEngine . Implementation (
96+ action ,
97+ context ,
98+ _onBulkheadRejected ,
99+ _maxParallelizationSemaphore ,
100+ _maxQueuedActionsSemaphore , cancellationToken ) ;
101+ }
78102
79103 /// <summary>
80104 /// Gets the number of slots currently available for executing actions through the bulkhead.
0 commit comments