-
Notifications
You must be signed in to change notification settings - Fork 811
SOLR-10461: move setAliveCheckInterval from clients into Builder #1217
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
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
4f0f93f
move setAliveCheckInterval from clients into Builder
epugh c10657a
Merge remote-tracking branch 'upstream/main' into SOLR-10461
epugh 0870cb6
Use a cleaner name
epugh 0fdf5c5
track changes
epugh 46b5c98
Merge branch 'main' into SOLR-10461
epugh 73f4208
Merge branch 'main' into SOLR-10461
epugh File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -57,8 +57,8 @@ | |
| * </blockquote> | ||
| * | ||
| * This detects if a dead server comes alive automatically. The check is done in fixed intervals in | ||
| * a dedicated thread. This interval can be set using {@link #setAliveCheckInterval} , the default | ||
| * is set to one minute. | ||
| * a dedicated thread. This interval can be set using {@link | ||
| * LBHttpSolrClient.Builder#setAliveCheckInterval(int)} , the default is set to one minute. | ||
| * | ||
| * <p><b>When to use this?</b><br> | ||
| * This can be used as a software load balancer when you do not wish to setup an external load | ||
|
|
@@ -92,6 +92,7 @@ protected LBHttpSolrClient(Builder builder) { | |
| this.connectionTimeout = builder.connectionTimeoutMillis; | ||
| this.soTimeout = builder.socketTimeoutMillis; | ||
| this.parser = builder.responseParser; | ||
| this.aliveCheckInterval = builder.aliveCheckInterval; | ||
| for (String baseUrl : builder.baseSolrUrls) { | ||
| urlToClient.put(baseUrl, makeSolrClient(baseUrl)); | ||
| } | ||
|
|
@@ -181,6 +182,7 @@ public HttpClient getHttpClient() { | |
| public static class Builder extends SolrClientBuilder<Builder> { | ||
| protected final List<String> baseSolrUrls; | ||
| protected HttpSolrClient.Builder httpSolrClientBuilder; | ||
| private int aliveCheckInterval; | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @epugh this should be init to the default CHECK_INTERVAL same as below https://github.com/apache/solr/pull/1217/files#diff-8a5ab47986f979f1134864e1352f6617e8d425f756018da7e0c1fa191fcc8fafR81 |
||
|
|
||
| public Builder() { | ||
| this.baseSolrUrls = new ArrayList<>(); | ||
|
|
@@ -259,6 +261,21 @@ public Builder withBaseSolrUrls(String... solrUrls) { | |
| return this; | ||
| } | ||
|
|
||
| /** | ||
| * LBHttpSolrServer keeps pinging the dead servers at fixed interval to find if it is alive. Use | ||
| * this to set that interval | ||
| * | ||
| * @param aliveCheckInterval time in milliseconds | ||
| */ | ||
| public Builder setAliveCheckInterval(int aliveCheckInterval) { | ||
| if (aliveCheckInterval <= 0) { | ||
| throw new IllegalArgumentException( | ||
| "Alive check interval must be " + "positive, specified value = " + aliveCheckInterval); | ||
| } | ||
| this.aliveCheckInterval = aliveCheckInterval; | ||
| return this; | ||
| } | ||
|
|
||
| /** | ||
| * Provides a {@link HttpSolrClient.Builder} to be used for building the internally used | ||
| * clients. | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same for this one. default should be CHECK_INTERVAL