Skip to content
Closed
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 @@ -410,15 +410,20 @@ private ClientConfiguration normalizeConfig(ClientConfiguration cfg) {
// cfg, so that a nonzero session_load supplied via the override sys-prop is honoured even when
// the server-returned config has session_load=0.
if (builder.getSessionConfiguration().getSessionLoad() == 0) {
builder.clearSessionConfiguration();
return builder.build();
if (Boolean.getBoolean("bigtable.internal.sessions-required")) {

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 system property key "bigtable.internal.sessions-required" is duplicated here and on line 425. Consider defining a constant for the property name to improve maintainability. Note that caching system properties or environment variables in class fields is unnecessary if they are only evaluated once during object initialization.

References
  1. Avoid caching system properties or environment variables in class fields if they are only evaluated once during object initialization, as caching is unnecessary in such cases.

builder.getSessionConfigurationBuilder().setSessionLoad(1.0f);
} else {
builder.clearSessionConfiguration();
return builder.build();
}
}

return builder.build();
}

public boolean areSessionsRequired() {
return overrideConfig.map(c -> c.getSessionConfiguration().getSessionLoad() > 0).orElse(false);
return Boolean.getBoolean("bigtable.internal.sessions-required")
|| overrideConfig.map(c -> c.getSessionConfiguration().getSessionLoad() > 0).orElse(false);
}

private long getRetryDelay(int attempt) {
Expand Down
Loading