mirror of https://github.com/apache/jclouds.git
scoped retryOnRenew binding to keystone as opposed to nova
This commit is contained in:
parent
f8ebb675b6
commit
4ba1da5d20
common/openstack/src/main/java/org/jclouds/openstack/keystone/v2_0
labs/openstack-nova/src/main/java/org/jclouds/openstack/nova/v1_1/config
|
@ -65,6 +65,7 @@ public class KeyStoneAuthenticationModule extends AbstractModule {
|
|||
protected void configure() {
|
||||
bind(new TypeLiteral<Function<Credentials, Access>>() {
|
||||
}).to(GetAccess.class);
|
||||
bind(HttpRetryHandler.class).annotatedWith(ClientError.class).to(RetryOnRenew.class);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -67,6 +67,7 @@ public class RetryOnRenew implements HttpRetryHandler {
|
|||
retry = false;
|
||||
} else {
|
||||
byte[] content = closeClientButKeepContentStream(response);
|
||||
//TODO: what is the error when the session token expires??
|
||||
if (content != null && new String(content).contains("lease renew")) {
|
||||
logger.debug("invalidating authentication token");
|
||||
authenticationResponseCache.invalidateAll();
|
||||
|
|
|
@ -24,12 +24,10 @@ import java.util.Map;
|
|||
import javax.inject.Singleton;
|
||||
|
||||
import org.jclouds.http.HttpErrorHandler;
|
||||
import org.jclouds.http.HttpRetryHandler;
|
||||
import org.jclouds.http.RequiresHttp;
|
||||
import org.jclouds.http.annotation.ClientError;
|
||||
import org.jclouds.http.annotation.Redirection;
|
||||
import org.jclouds.http.annotation.ServerError;
|
||||
import org.jclouds.http.handlers.BackoffLimitedRetryHandler;
|
||||
import org.jclouds.openstack.keystone.v2_0.config.KeyStoneAuthenticationModule;
|
||||
import org.jclouds.openstack.keystone.v2_0.domain.Access;
|
||||
import org.jclouds.openstack.keystone.v2_0.domain.Service;
|
||||
|
@ -86,11 +84,6 @@ public class NovaRestClientModule extends RestClientModule<NovaClient, NovaAsync
|
|||
bind(HttpErrorHandler.class).annotatedWith(ServerError.class).to(NovaErrorHandler.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void bindRetryHandlers() {
|
||||
bind(HttpRetryHandler.class).annotatedWith(ClientError.class).to(BackoffLimitedRetryHandler.class);
|
||||
}
|
||||
|
||||
@Provides
|
||||
@Singleton
|
||||
@Compute
|
||||
|
|
Loading…
Reference in New Issue