Class ChannelPoolSettings.Builder
- Enclosing class:
- ChannelPoolSettings
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuild()abstract ChannelPoolSettings.BuildersetInitialChannelCount(int count) Sets the initial number of channels in the pool.abstract ChannelPoolSettings.BuildersetMaxChannelCount(int count) Sets the maximum number of channels the pool can expand to.abstract ChannelPoolSettings.BuildersetMaxResizeDelta(int count) Sets the maximum number of channels that can be added or removed in a single resize cycle.abstract ChannelPoolSettings.BuildersetMaxRpcsPerChannel(int count) Sets the maximum desired number of concurrent RPCs per channel.abstract ChannelPoolSettings.BuildersetMinChannelCount(int count) Sets the minimum number of channels the pool can shrink to.abstract ChannelPoolSettings.BuildersetMinRpcsPerChannel(int count) Sets the minimum desired number of concurrent RPCs per channel.abstract ChannelPoolSettings.BuildersetPreemptiveRefreshEnabled(boolean enabled) Sets whether preemptive channel refresh is enabled to prevent channels from becoming idle.
-
Constructor Details
-
Builder
public Builder()
-
-
Method Details
-
setMinRpcsPerChannel
Sets the minimum desired number of concurrent RPCs per channel.This ensures channels are adequately utilized. If the average load per channel falls below this value, the pool attempts to shrink. The resulting target channel count is a dynamic value determined by load and is bounded by
setMinChannelCount(int)andsetMaxChannelCount(int). -
setMaxRpcsPerChannel
Sets the maximum desired number of concurrent RPCs per channel.This ensures channels do not become overloaded. If the average load per channel exceeds this value, the pool attempts to expand. The resulting target channel count is a dynamic value determined by load and is bounded by
setMinChannelCount(int)andsetMaxChannelCount(int). -
setMinChannelCount
Sets the minimum number of channels the pool can shrink to.When resizing, if the calculated resize bounds fall below this minimum configuration, the bounds will be clamped to this value. This ensures the pool never shrinks below this absolute minimum, even under very low load.
-
setMaxChannelCount
Sets the maximum number of channels the pool can expand to.When resizing, if the calculated resize bounds exceed this maximum configuration, the bounds will be clamped to this value. This ensures the pool never expands above this absolute maximum, even under very high load.
-
setInitialChannelCount
Sets the initial number of channels in the pool. -
setPreemptiveRefreshEnabled
Sets whether preemptive channel refresh is enabled to prevent channels from becoming idle. -
setMaxResizeDelta
Sets the maximum number of channels that can be added or removed in a single resize cycle. This acts as a rate limiter to prevent wild fluctuations. The pool resizes periodically according toChannelPoolSettings.RESIZE_INTERVAL(default 1 minute). During resizing, this value is effectively capped by the bound configured viasetMaxChannelCount(int).Warning: Higher values for resize delta may still result in performance degradation during spikes due to rapid scaling.
-
build
-