> +import static org.jclouds.util.Throwables2.getFirstThrowableOfType;
> +
> +public class EmptyQueuesFallback implements Fallback<Queues> {
> +
> + public ListenableFuture<Queues> create(Throwable t) throws Exception {
> + return immediateFuture(createOrPropagate(t));
> + }
> +
> + public Queues createOrPropagate(Throwable t) throws Exception {
> +
> + return valOnNotFoundOr404(Queues.EMPTY,
> + checkNotNull(t, "throwable"));
> + }
> +
> + public static Queues valOnNotFoundOr404(Queues val, Throwable t) {
> + if (containsResourceNotFoundException(checkNotNull(t, "throwable")) ||
> contains404(t)) {
The two helper methods are based on very similar methods in Fallbacks, which is
why they are here like that.
https://github.com/jclouds/jclouds/blob/master/core/src/main/java/org/jclouds/Fallbacks.java#L190
I guess it makes sense to refactor them here.
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-labs-openstack/pull/96/files#r13494813