Skip to content

Commit

Permalink
Simplify initialization of Settings (#10194) (#10317)
Browse files Browse the repository at this point in the history
There was a weird circular class-loading dependency between Settings and
Settings.Builder that could result in ClassLoader deadlock if multiple
threads trigger class-loading of Settings at the same time.


(cherry picked from commit d3bf230)

Signed-off-by: Michael Froh <froh@amazon.com>
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Signed-off-by: Daniel (dB.) Doubrovkine <dblock@amazon.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: Daniel (dB.) Doubrovkine <dblock@amazon.com>
  • Loading branch information
3 people authored Oct 4, 2023
1 parent d48aa44 commit 6170dd9
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
- Fix concurrent search NPE when track_total_hits, terminate_after and size=0 are used ([#10082](https://github.com/opensearch-project/OpenSearch/pull/10082))
- Fix remove ingest processor handing ignore_missing parameter not correctly ([10089](https://github.com/opensearch-project/OpenSearch/pull/10089))
- Fix registration and initialization of multiple extensions ([10256](https://github.com/opensearch-project/OpenSearch/pull/10256))
- Fix circular dependency in Settings initialization ([10194](https://github.com/opensearch-project/OpenSearch/pull/10194))

### Security

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@
@PublicApi(since = "1.0.0")
public final class Settings implements ToXContentFragment {

public static final Settings EMPTY = new Builder().build();
public static final Settings EMPTY = new Settings(Collections.emptyMap(), null);

/** The raw settings from the full key to raw string value. */
private final Map<String, Object> settings;
Expand Down Expand Up @@ -757,7 +757,7 @@ public Set<String> keySet() {
@PublicApi(since = "1.0.0")
public static class Builder {

public static final Settings EMPTY_SETTINGS = new Builder().build();
public static final Settings EMPTY_SETTINGS = Settings.EMPTY;

// we use a sorted map for consistent serialization when using getAsMap()
private final Map<String, Object> map = new TreeMap<>();
Expand Down

0 comments on commit 6170dd9

Please sign in to comment.