@@ -115,12 +115,14 @@ public DynamicFlowControlSettings build() {
115115 }
116116
117117 private void verifyElementCountSettings (DynamicFlowControlSettings settings ) {
118- boolean isEnabled =
119- settings .getLimitExceededBehavior () != LimitExceededBehavior .Ignore
120- && (settings .getInitialOutstandingElementCount () != null
121- || settings .getMinOutstandingElementCount () != null
122- || settings .getMaxOutstandingElementCount () != null );
123- if (!isEnabled ) {
118+ // If LimitExceededBehavior is Ignore, dynamic flow control is disabled, there's no need to
119+ // check element count limit settings
120+ if (settings .getLimitExceededBehavior () == LimitExceededBehavior .Ignore ) {
121+ return ;
122+ }
123+ if (settings .getInitialOutstandingElementCount () == null
124+ && settings .getMinOutstandingElementCount () == null
125+ && settings .getMaxOutstandingElementCount () == null ) {
124126 return ;
125127 }
126128 Preconditions .checkState (
@@ -142,12 +144,14 @@ private void verifyElementCountSettings(DynamicFlowControlSettings settings) {
142144 }
143145
144146 private void verifyRequestBytesSettings (DynamicFlowControlSettings settings ) {
145- boolean isEnabled =
146- settings .getLimitExceededBehavior () != LimitExceededBehavior .Ignore
147- && (settings .getInitialOutstandingRequestBytes () != null
148- || settings .getMinOutstandingRequestBytes () != null
149- || settings .getMaxOutstandingRequestBytes () != null );
150- if (!isEnabled ) {
147+ // If LimitExceededBehavior is Ignore, dynamic flow control is disabled, there's no need to
148+ // check request bytes limit settings
149+ if (settings .getLimitExceededBehavior () == LimitExceededBehavior .Ignore ) {
150+ return ;
151+ }
152+ if (settings .getInitialOutstandingRequestBytes () == null
153+ && settings .getMinOutstandingRequestBytes () == null
154+ && settings .getMaxOutstandingRequestBytes () == null ) {
151155 return ;
152156 }
153157 Preconditions .checkState (
0 commit comments