@@ -100,10 +100,6 @@ public abstract class ChannelPoolSettings {
100100 * the pool better handle sudden bursts or spikes in requests by allowing it to scale up faster.
101101 * Regardless of this setting, the number of channels will never exceed {@link
102102 * #getMaxChannelCount()}.
103- *
104- * <p><b>Warning:</b> It is not recommended to configure this value to exceed {@link
105- * #getMaxChannelCount()}. While the resizing logic safely handles larger values by clamping
106- * adjustments to the bounds, setting it excessively high may obscure configuration intent.
107103 */
108104 public abstract int getMaxResizeDelta ();
109105
@@ -143,6 +139,7 @@ public static ChannelPoolSettings staticallySized(int size) {
143139 .setMaxRpcsPerChannel (Integer .MAX_VALUE )
144140 .setMinChannelCount (size )
145141 .setMaxChannelCount (size )
142+ .setMaxResizeDelta (Math .min (DEFAULT_MAX_RESIZE_DELTA , size ))
146143 .build ();
147144 }
148145
@@ -194,6 +191,9 @@ public ChannelPoolSettings build() {
194191 s .getInitialChannelCount () > 0 , "Initial channel count must be greater than 0" );
195192 Preconditions .checkState (
196193 s .getMaxResizeDelta () > 0 , "Max resize delta must be greater than 0" );
194+ Preconditions .checkState (
195+ s .getMaxResizeDelta () <= s .getMaxChannelCount (),
196+ "Max resize delta cannot be greater than max channel count" );
197197 return s ;
198198 }
199199 }
0 commit comments