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
4 changes: 2 additions & 2 deletions sdk/java/src/main/java/com/chain/http/Client.java
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ private <T> T post(String path, Object body, ResponseCreator<T> respCreator)
int idx = this.urlIndex.get();
URL endpointURL;
try {
URI u = new URI(this.urls.get(idx).toString() + "/" + path);
URI u = new URI(this.urls.get(idx % this.urls.size()).toString() + "/" + path);
u = u.normalize();
endpointURL = new URL(u.toString());
} catch (MalformedURLException ex) {
Expand Down Expand Up @@ -473,7 +473,7 @@ private void nextURL(int failedIndex) {

// A request to the url at failedIndex just failed. Move to the next
// URL in the list.
int nextIndex = (failedIndex + 1) % this.urls.size();
int nextIndex = failedIndex + 1;
this.urlIndex.compareAndSet(failedIndex, nextIndex);
}

Expand Down