added comments to clarify RequestLogger and DeadHostState

This commit is contained in:
javanna 2016-06-13 12:59:30 +02:00 committed by Luca Cavanna
parent 3cd201e67e
commit 8f7b7fb813
2 changed files with 7 additions and 0 deletions

View File

@ -41,6 +41,11 @@ final class DeadHostState {
this.deadUntilNanos = System.nanoTime() + MIN_CONNECTION_TIMEOUT_NANOS;
}
/**
* We keep track of how many times a certain node fails consecutively. The higher that number is the longer we will wait
* to retry that same node again. Minimum is 1 minute (for a node the only failed once), maximum is 30 minutes (for a node
* that failed many consecutive times).
*/
DeadHostState(DeadHostState previousDeadHostState) {
long timeoutNanos = (long)Math.min(MIN_CONNECTION_TIMEOUT_NANOS * 2 * Math.pow(2, previousDeadHostState.failedAttempts * 0.5 - 1),
MAX_CONNECTION_TIMEOUT_NANOS);

View File

@ -40,6 +40,8 @@ import java.nio.charset.StandardCharsets;
/**
* Helper class that exposes static methods to unify the way requests are logged.
* Includes trace logging to log complete requests and responses in curl format.
* Useful for debugging, manually sending logged requests via curl and checking their responses.
* Trace logging is a feature that all the language clients provide.
*/
final class RequestLogger {