@@ -158,18 +158,57 @@ public static Builder builder() {
158158
159159 @ AutoValue .Builder
160160 public abstract static class Builder {
161+ /**
162+ * Sets the minimum desired number of concurrent RPCs per channel.
163+ *
164+ * <p>This ensures channels are adequately utilized. If the average load per channel falls below
165+ * this value, the pool attempts to shrink. The resulting target channel count is a dynamic
166+ * value determined by load and is bounded by {@link #setMinChannelCount} and {@link
167+ * #setMaxChannelCount}.
168+ */
161169 public abstract Builder setMinRpcsPerChannel (int count );
162170
171+ /**
172+ * Sets the maximum desired number of concurrent RPCs per channel.
173+ *
174+ * <p>This ensures channels do not become overloaded. If the average load per channel exceeds
175+ * this value, the pool attempts to expand. The resulting target channel count is a dynamic
176+ * value determined by load and is bounded by {@link #setMinChannelCount} and {@link
177+ * #setMaxChannelCount}.
178+ */
163179 public abstract Builder setMaxRpcsPerChannel (int count );
164180
181+ /**
182+ * Sets the minimum number of channels the pool can shrink to.
183+ *
184+ * <p>When resizing, if the calculated resize bounds fall below this minimum configuration, the
185+ * bounds will be clamped to this value. This ensures the pool never shrinks below this absolute
186+ * minimum, even under very low load.
187+ */
165188 public abstract Builder setMinChannelCount (int count );
166189
190+ /**
191+ * Sets the maximum number of channels the pool can expand to.
192+ *
193+ * <p>When resizing, if the calculated resize bounds exceed this maximum configuration, the
194+ * bounds will be clamped to this value. This ensures the pool never expands above this absolute
195+ * maximum, even under very high load.
196+ */
167197 public abstract Builder setMaxChannelCount (int count );
168198
199+ /** Sets the initial number of channels in the pool. */
169200 public abstract Builder setInitialChannelCount (int count );
170201
202+ /**
203+ * Sets whether preemptive channel refresh is enabled to prevent channels from becoming idle.
204+ */
171205 public abstract Builder setPreemptiveRefreshEnabled (boolean enabled );
172206
207+ /**
208+ * Sets the maximum number of channels that can be added or removed in a single resize cycle.
209+ * This acts as a rate limiter to prevent wild fluctuations. The pool resizes periodically
210+ * according to {@link #RESIZE_INTERVAL} (default 1 minute).
211+ */
173212 public abstract Builder setMaxResizeDelta (int count );
174213
175214 abstract ChannelPoolSettings autoBuild ();
@@ -193,9 +232,6 @@ public ChannelPoolSettings build() {
193232 s .getInitialChannelCount () > 0 , "Initial channel count must be greater than 0" );
194233 Preconditions .checkState (
195234 s .getMaxResizeDelta () > 0 , "Max resize delta must be greater than 0" );
196- Preconditions .checkState (
197- s .getMaxResizeDelta () <= s .getMaxChannelCount (),
198- "Max resize delta cannot be greater than max channel count" );
199235 return s ;
200236 }
201237 }
0 commit comments