Skip to content

Fix serviceConfig within scope of copy #211

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
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 @@ -153,9 +153,9 @@ public Health getHealth() {
/**
* Map representation of the service config to use for the channel
*/
private final Map<String, ?> serviceConfig = new HashMap<>();
private final Map<String, Object> serviceConfig = new HashMap<>();

public Map<String, ?> getServiceConfig() {
public Map<String, Object> getServiceConfig() {
return this.serviceConfig;
}

Expand Down Expand Up @@ -349,6 +349,8 @@ public ChannelConfig copy() {
copy.defaultDeadline = this.defaultDeadline;
copy.health.copyValuesFrom(this.getHealth());
copy.ssl.copyValuesFrom(this.getSsl());
copy.serviceConfig.clear();
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we can drop this clear call.

copy.serviceConfig.putAll(this.serviceConfig);
return copy;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,7 @@ void copyFromDefaultChannel() {
var defaultChannel = properties.getDefaultChannel();
var newChannel = defaultChannel.copy();
assertThat(newChannel).usingRecursiveComparison().isEqualTo(defaultChannel);
assertThat(newChannel.getServiceConfig()).isEqualTo(defaultChannel.getServiceConfig());
}

}
Expand Down