org.jclouds.rest.suppliers
Class MemoizedRetryOnTimeOutButNotOnAuthorizationExceptionSupplier<T>
java.lang.Object
org.jclouds.rest.suppliers.MemoizedRetryOnTimeOutButNotOnAuthorizationExceptionSupplier<T>
- All Implemented Interfaces:
- com.google.common.base.Supplier<T>
public class MemoizedRetryOnTimeOutButNotOnAuthorizationExceptionSupplier<T>
- extends Object
- implements com.google.common.base.Supplier<T>
This will retry the supplier if it encounters a timeout exception, but not if it encounters an
AuthorizationException.
A shared exception reference is used so that anyone who encounters an authorizationexception will
be short-circuited. This prevents accounts from being locked out.
details
http://code.google.com/p/google-guice/issues/detail?id=483 guice doesn't remember when singleton
providers throw exceptions. in this case, if the supplier fails with an authorization exception,
it is called again for each provider method that depends on it. To short-circuit this, we
remember the last exception trusting that guice is single-threaded.
- Author:
- Adrian Cole
MemoizedRetryOnTimeOutButNotOnAuthorizationExceptionSupplier
public MemoizedRetryOnTimeOutButNotOnAuthorizationExceptionSupplier(AtomicReference<AuthorizationException> authException,
long seconds,
com.google.common.base.Supplier<T> delegate)
create
public static <T> MemoizedRetryOnTimeOutButNotOnAuthorizationExceptionSupplier<T> create(AtomicReference<AuthorizationException> authException,
long seconds,
com.google.common.base.Supplier<T> delegate)
get
public T get()
- Specified by:
get
in interface com.google.common.base.Supplier<T>
toString
public String toString()
- Overrides:
toString
in class Object
Copyright © 2009-2012 jclouds. All Rights Reserved.