Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -62,18 +62,15 @@
* A {@link ManagedChannel} that will send requests round-robin via a set of channels.
*
* <p>In addition to spreading requests over a set of child connections, the pool will also actively
* manage the lifecycle of the channels. Currently lifecycle management is limited to pre-emptively
* manage the lifecycle of the channels. Currently, lifecycle management is limited to pre-emptively
* replacing channels every hour. In the future it will dynamically size the pool based on number of
* outstanding requests.
*
* <p>Package-private for internal use.
*/
class ChannelPool extends ManagedChannel {
static final String CHANNEL_POOL_CONSECUTIVE_RESIZING_WARNING =
"Channel pool is repeatedly resizing. "
+ "Consider adjusting `initialChannelCount` or `maxResizeDelta` to a more reasonable value. "
+ "See https://docs.cloud.google.com/java/docs/troubleshooting to enable logging "
+ "and set `com.google.api.gax.grpc.ChannelPool.level=FINEST` to log the channel pool resize behavior.";
"The gRPC ChannelPool used in the client has been flagged to be repeatedly resizing (5+ times). See https://github.com/googleapis/google-cloud-java/blob/main/docs/grpc_channel_pool_guide.md for more information about this behavior.";
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The warning message string is very long (over 200 characters), which hinders readability and violates the standard 100-character line limit. While long URLs are sometimes allowed to exceed the limit, the preceding and following text should be wrapped. Additionally, per repository rules, prefer using StringBuilder for multi-line string concatenations in Java, as it is generally more performant than using the + operator.

Suggested change
"The gRPC ChannelPool used in the client has been flagged to be repeatedly resizing (5+ times). See https://github.com/googleapis/google-cloud-java/blob/main/docs/grpc_channel_pool_guide.md for more information about this behavior.";
new StringBuilder()
.append("The gRPC ChannelPool used in the client has been flagged to be repeatedly ")
.append("resizing (5+ times). See ")
.append("https://github.com/googleapis/google-cloud-java/blob/main/docs/grpc_channel_pool_guide.md ")
.append("for more information about this behavior.")
.toString();
References
  1. Each line of text is limited to 100 characters. While there is an exception for long URLs, the surrounding text should be wrapped to keep the code readable. (link)
  2. Prefer StringBuilder for multi-line string concatenations in Java, especially when performance is a consideration, as it is generally more performant than using the + operator.

@VisibleForTesting static final Logger LOG = Logger.getLogger(ChannelPool.class.getName());
private static final java.time.Duration REFRESH_PERIOD = java.time.Duration.ofMinutes(50);

Expand Down
Loading