File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed
concurrency-limits-core/src/main/java/com/netflix/concurrency/limits/limiter Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -39,7 +39,8 @@ public abstract class AbstractLimiter<ContextT> implements Limiter<ContextT> {
3939 */
4040 public abstract static class BypassLimiterBuilder <BuilderT extends BypassLimiterBuilder <BuilderT , ContextT >, ContextT > extends Builder <BuilderT > {
4141
42- private Predicate <ContextT > bypassResolver = (context ) -> false ;
42+ private final Predicate <ContextT > ALWAYS_FALSE = (context ) -> false ;
43+ private Predicate <ContextT > bypassResolver = ALWAYS_FALSE ;
4344
4445 /**
4546 * Add a chainable bypass resolver predicate from context. Multiple resolvers may be added and if any of the
@@ -49,7 +50,11 @@ public abstract static class BypassLimiterBuilder<BuilderT extends BypassLimiter
4950 * @return Chainable builder
5051 */
5152 public BuilderT bypassLimitResolver (Predicate <ContextT > shouldBypass ) {
52- this .bypassResolver = bypassResolver .or (shouldBypass );
53+ if (this .bypassResolver == ALWAYS_FALSE ) {
54+ this .bypassResolver = shouldBypass ;
55+ } else {
56+ this .bypassResolver = bypassResolver .or (shouldBypass );
57+ }
5358 return self ();
5459 }
5560 }
You can’t perform that action at this time.
0 commit comments