Skip to content

Commit

Permalink
Merge pull request #246 from mziccard/better-options-retryparams-doc
Browse files Browse the repository at this point in the history
More detailed javadoc for options.retryParams and RetryParams
  • Loading branch information
aozarov committed Oct 12, 2015
2 parents 2ffd822 + 75f1c09 commit e844c36
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 10 deletions.
19 changes: 12 additions & 7 deletions gcloud-java-core/src/main/java/com/google/gcloud/RetryParams.java
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ public final class RetryParams implements Serializable {
private static final RetryParams NO_RETRIES =
builder().retryMaxAttempts(1).retryMinAttempts(1).build();


/**
* RetryParams builder.
*/
Expand Down Expand Up @@ -206,47 +205,53 @@ public static RetryParams getDefaultInstance() {
return DEFAULT_INSTANCE;
}

/**
* Returns an instance of {@code RetryParams} where `retryMaxAttempts` and `retryMinAttempts` are
* set to `1`.
*/
public static RetryParams noRetries() {
return NO_RETRIES;
}

/**
* Returns the retryMinAttempts.
* Returns the retryMinAttempts. Default value is {@value #DEFAULT_RETRY_MIN_ATTEMPTS}.
*/
public int getRetryMinAttempts() {
return retryMinAttempts;
}

/**
* Returns the retryMaxAttempts.
* Returns the retryMaxAttempts. Default value is {@value #DEFAULT_RETRY_MAX_ATTEMPTS}.
*/
public int getRetryMaxAttempts() {
return retryMaxAttempts;
}

/**
* Returns the initialRetryDelayMillis.
* Returns the initialRetryDelayMillis. Default value is
* {@value #DEFAULT_INITIAL_RETRY_DELAY_MILLIS}.
*/
public long getInitialRetryDelayMillis() {
return initialRetryDelayMillis;
}

/**
* Returns the maxRetryDelayMillis.
* Returns the maxRetryDelayMillis. Default values is {@value #DEFAULT_MAX_RETRY_DELAY_MILLIS}.
*/
public long getMaxRetryDelayMillis() {
return maxRetryDelayMillis;
}

/**
* Returns the maxRetryDelayBackoffFactor.
* Returns the maxRetryDelayBackoffFactor. Default values is
* {@value #DEFAULT_RETRY_DELAY_BACKOFF_FACTOR}.
*/
public double getRetryDelayBackoffFactor() {
return retryDelayBackoffFactor;
}

/**
* Returns the totalRetryPeriodMillis.
* Returns the totalRetryPeriodMillis. Default value is {@value #DEFAULT_TOTAL_RETRY_PERIOD_MILLIS}.
*/
public long getTotalRetryPeriodMillis() {
return totalRetryPeriodMillis;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

package com.google.gcloud;


import static com.google.common.base.MoreObjects.firstNonNull;
import static com.google.common.base.Preconditions.checkNotNull;
import static java.nio.charset.StandardCharsets.UTF_8;
Expand Down Expand Up @@ -167,7 +166,8 @@ public B authCredentials(AuthCredentials authCredentials) {
}

/**
* Sets configuration parameters for request retries.
* Sets configuration parameters for request retries. If no configuration is set
* {@link RetryParams#noRetries()} is used.
*
* @return the builder.
*/
Expand Down Expand Up @@ -367,7 +367,8 @@ public AuthCredentials authCredentials() {
}

/**
* Returns configuration parameters for request retries.
* Returns configuration parameters for request retries. By default requests are not retried:
* {@link RetryParams#noRetries()} is used.
*/
public RetryParams retryParams() {
return retryParams != null ? retryParams : RetryParams.noRetries();
Expand Down

0 comments on commit e844c36

Please sign in to comment.