scoped retryOnRenew binding to keystone as opposed to nova

This commit is contained in:
Adrian Cole 2012-01-31 11:15:16 -08:00
parent f8ebb675b6
commit 4ba1da5d20
3 changed files with 2 additions and 7 deletions

View File

@ -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);
}
/**

View File

@ -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();

View File

@ -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