Skip to content

Commit

Permalink
make comments hard to read to appease spotless
Browse files Browse the repository at this point in the history
  • Loading branch information
stoty committed Apr 9, 2024
1 parent 2d1f0b0 commit 1e56c9a
Showing 1 changed file with 15 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -251,19 +251,12 @@ public void removeExtraHeader(final String name) {
}

/**
* Execute a transaction method given only the path.
*
* If sticky is false:
* Will select at random one of the members of
* the supplied cluster definition and iterate through the list until a transaction can be
* successfully completed. The definition of success here is a complete HTTP transaction,
* irrespective of result code.
*
* If sticky is true:
* For the first request it will select a random one of the members of the supplied cluster definition.
* For subsequent requests it will use the same member, and it will not automatically re-try
* if the call fails.
*
* Execute a transaction method given only the path. If sticky is false: Will select at random one
* of the members of the supplied cluster definition and iterate through the list until a
* transaction can be successfully completed. The definition of success here is a complete HTTP
* transaction, irrespective of result code. If sticky is true: For the first request it will
* select a random one of the members of the supplied cluster definition. For subsequent requests
* it will use the same member, and it will not automatically re-try if the call fails.
* @param cluster the cluster definition
* @param method the transaction method
* @param headers HTTP header values to send
Expand All @@ -276,7 +269,7 @@ public HttpResponse executePathOnly(Cluster cluster, HttpUriRequest method, Head
if (cluster.nodes.size() < 1) {
throw new IOException("Cluster is empty");
}
if(lastNodeId == null || !sticky) {
if (lastNodeId == null || !sticky) {
lastNodeId = (int) (cluster.nodes.size() * Math.random());
}
int start = lastNodeId;
Expand Down Expand Up @@ -318,7 +311,7 @@ public HttpResponse executePathOnly(Cluster cluster, HttpUriRequest method, Head
if (!sticky) {
lastNodeId = (++lastNodeId) % cluster.nodes.size();
}
// Do not retry if sticky. Let the caller handle the error.
// Do not retry if sticky. Let the caller handle the error.
} while (!sticky && lastNodeId != start);
throw lastException;
}
Expand Down Expand Up @@ -424,27 +417,20 @@ public void setCluster(Cluster cluster) {
}

/**
* The default behaviour is load balancing by sending each request to a random host.
*
* This DOES NOT work with scans, which have state on the REST servers.
* Make sure sticky is set to true before attempting Scan related operations if
* more than one host is defined in the cluster.
*
* The default behaviour is load balancing by sending each request to a random host. This DOES NOT
* work with scans, which have state on the REST servers. Make sure sticky is set to true before
* attempting Scan related operations if more than one host is defined in the cluster.
* @return whether subsequent requests will use the same host
*/
public boolean isSticky() {
return sticky;
}

/**
* The default behaviour is load balancing by sending each request to a random host.
*
* This DOES NOT work with scans, which have state on the REST servers.
* Set sticky to true before attempting Scan related operations if
* more than one host is defined in the cluster.
*
* Nodes must not be added or removed from the Cluster object while sticky is true.
*
* The default behaviour is load balancing by sending each request to a random host. This DOES NOT
* work with scans, which have state on the REST servers. Set sticky to true before attempting
* Scan related operations if more than one host is defined in the cluster. Nodes must not be
* added or removed from the Cluster object while sticky is true.
* @param sticky whether subsequent requests will use the same host
*/
public void setSticky(boolean sticky) {
Expand Down

0 comments on commit 1e56c9a

Please sign in to comment.