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> {
39
39
*/
40
40
public abstract static class BypassLimiterBuilder <BuilderT extends BypassLimiterBuilder <BuilderT , ContextT >, ContextT > extends Builder <BuilderT > {
41
41
42
- private Predicate <ContextT > bypassResolver = (context ) -> false ;
42
+ private final Predicate <ContextT > ALWAYS_FALSE = (context ) -> false ;
43
+ private Predicate <ContextT > bypassResolver = ALWAYS_FALSE ;
43
44
44
45
/**
45
46
* 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
49
50
* @return Chainable builder
50
51
*/
51
52
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
+ }
53
58
return self ();
54
59
}
55
60
}
You can’t perform that action at this time.
0 commit comments