mirror of https://github.com/apache/jclouds.git
parent
88f0c341cf
commit
5067897ff5
|
@ -231,7 +231,7 @@
|
||||||
<auto-value.version>1.4.1</auto-value.version>
|
<auto-value.version>1.4.1</auto-value.version>
|
||||||
|
|
||||||
<jetty.version>9.4.46.v20220331</jetty.version>
|
<jetty.version>9.4.46.v20220331</jetty.version>
|
||||||
<javax.ws.rs-api.version>2.0.1</javax.ws.rs-api.version>
|
<javax.ws.rs-api.version>2.1.1</javax.ws.rs-api.version>
|
||||||
|
|
||||||
<modernizer-maven-annotations.version>1.8.0</modernizer-maven-annotations.version>
|
<modernizer-maven-annotations.version>1.8.0</modernizer-maven-annotations.version>
|
||||||
|
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
package org.jclouds.googlecloudstorage.handlers;
|
package org.jclouds.googlecloudstorage.handlers;
|
||||||
|
|
||||||
import javax.inject.Singleton;
|
import javax.inject.Singleton;
|
||||||
|
import javax.ws.rs.core.Response.Status;
|
||||||
|
|
||||||
import org.jclouds.http.HttpCommand;
|
import org.jclouds.http.HttpCommand;
|
||||||
import org.jclouds.http.HttpResponse;
|
import org.jclouds.http.HttpResponse;
|
||||||
|
@ -27,10 +28,6 @@ import com.google.inject.Inject;
|
||||||
|
|
||||||
@Singleton
|
@Singleton
|
||||||
public final class GoogleCloudStorageClientErrorRetryHandler implements HttpRetryHandler {
|
public final class GoogleCloudStorageClientErrorRetryHandler implements HttpRetryHandler {
|
||||||
/** The user has sent too many requests in a given amount of time ("rate limiting"). */
|
|
||||||
// TODO: remove when upgrading to jax-rs api 2.1
|
|
||||||
private static final int TOO_MANY_REQUESTS = 429;
|
|
||||||
|
|
||||||
private final BackoffLimitedRetryHandler backoffHandler;
|
private final BackoffLimitedRetryHandler backoffHandler;
|
||||||
|
|
||||||
@Inject
|
@Inject
|
||||||
|
@ -40,7 +37,7 @@ public final class GoogleCloudStorageClientErrorRetryHandler implements HttpRetr
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean shouldRetryRequest(HttpCommand command, HttpResponse response) {
|
public boolean shouldRetryRequest(HttpCommand command, HttpResponse response) {
|
||||||
if (response.getStatusCode() == TOO_MANY_REQUESTS) {
|
if (response.getStatusCode() == Status.TOO_MANY_REQUESTS.getStatusCode()) {
|
||||||
return backoffHandler.shouldRetryRequest(command, response);
|
return backoffHandler.shouldRetryRequest(command, response);
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
|
|
Loading…
Reference in New Issue