From a164c071a903c6cd31da7b0d2cc33c2997f8a677 Mon Sep 17 00:00:00 2001 From: Adrian Cole Date: Mon, 6 Oct 2014 13:35:44 -0700 Subject: [PATCH] JCLOUDS-40 unasync Fallback. --- .../v2/fallbacks/EmptyFloatingIPsFallback.java | 17 +++++------------ .../v2/fallbacks/EmptyNetworksFallback.java | 17 +++++------------ .../v2/fallbacks/EmptyPortsFallback.java | 17 +++++------------ .../v2/fallbacks/EmptyRoutersFallback.java | 17 +++++------------ .../v2/fallbacks/EmptyRulesFallback.java | 7 ------- .../fallbacks/EmptySecurityGroupsFallback.java | 17 +++++------------ .../v2/fallbacks/EmptySubnetsFallback.java | 17 +++++------------ .../lbaas/v1/EmptyHealthMonitorsFallback.java | 8 -------- .../lbaas/v1/EmptyMembersFallback.java | 8 -------- .../fallbacks/lbaas/v1/EmptyPoolsFallback.java | 8 -------- .../fallbacks/lbaas/v1/EmptyVIPsFallback.java | 8 -------- 11 files changed, 30 insertions(+), 111 deletions(-) diff --git a/apis/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/fallbacks/EmptyFloatingIPsFallback.java b/apis/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/fallbacks/EmptyFloatingIPsFallback.java index b9b03c43ee..ede904607b 100644 --- a/apis/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/fallbacks/EmptyFloatingIPsFallback.java +++ b/apis/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/fallbacks/EmptyFloatingIPsFallback.java @@ -17,23 +17,16 @@ package org.jclouds.openstack.neutron.v2.fallbacks; -import com.google.common.util.concurrent.ListenableFuture; +import static com.google.common.base.Preconditions.checkNotNull; +import static com.google.common.base.Throwables.propagate; +import static org.jclouds.http.HttpUtils.contains404; +import static org.jclouds.util.Throwables2.getFirstThrowableOfType; + import org.jclouds.Fallback; import org.jclouds.openstack.neutron.v2.domain.FloatingIPs; import org.jclouds.rest.ResourceNotFoundException; -import static com.google.common.base.Preconditions.checkNotNull; -import static com.google.common.base.Throwables.propagate; -import static com.google.common.util.concurrent.Futures.immediateFuture; -import static org.jclouds.http.HttpUtils.contains404; -import static org.jclouds.util.Throwables2.getFirstThrowableOfType; - public class EmptyFloatingIPsFallback implements Fallback { - - public ListenableFuture create(Throwable t) throws Exception { - return immediateFuture(createOrPropagate(t)); - } - @Override public FloatingIPs createOrPropagate(Throwable t) throws Exception { if ((getFirstThrowableOfType(checkNotNull(t, "throwable"), ResourceNotFoundException.class) != null) diff --git a/apis/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/fallbacks/EmptyNetworksFallback.java b/apis/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/fallbacks/EmptyNetworksFallback.java index 3a859a9b9b..8410afb9b3 100644 --- a/apis/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/fallbacks/EmptyNetworksFallback.java +++ b/apis/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/fallbacks/EmptyNetworksFallback.java @@ -17,23 +17,16 @@ package org.jclouds.openstack.neutron.v2.fallbacks; -import com.google.common.util.concurrent.ListenableFuture; +import static com.google.common.base.Preconditions.checkNotNull; +import static com.google.common.base.Throwables.propagate; +import static org.jclouds.http.HttpUtils.contains404; +import static org.jclouds.util.Throwables2.getFirstThrowableOfType; + import org.jclouds.Fallback; import org.jclouds.openstack.neutron.v2.domain.Networks; import org.jclouds.rest.ResourceNotFoundException; -import static com.google.common.base.Preconditions.checkNotNull; -import static com.google.common.base.Throwables.propagate; -import static com.google.common.util.concurrent.Futures.immediateFuture; -import static org.jclouds.http.HttpUtils.contains404; -import static org.jclouds.util.Throwables2.getFirstThrowableOfType; - public class EmptyNetworksFallback implements Fallback { - - public ListenableFuture create(Throwable t) throws Exception { - return immediateFuture(createOrPropagate(t)); - } - @Override public Networks createOrPropagate(Throwable t) throws Exception { if ((getFirstThrowableOfType(checkNotNull(t, "throwable"), ResourceNotFoundException.class) != null) diff --git a/apis/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/fallbacks/EmptyPortsFallback.java b/apis/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/fallbacks/EmptyPortsFallback.java index 2ca5c84a36..ac2e0db9f1 100644 --- a/apis/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/fallbacks/EmptyPortsFallback.java +++ b/apis/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/fallbacks/EmptyPortsFallback.java @@ -17,23 +17,16 @@ package org.jclouds.openstack.neutron.v2.fallbacks; -import com.google.common.util.concurrent.ListenableFuture; +import static com.google.common.base.Preconditions.checkNotNull; +import static com.google.common.base.Throwables.propagate; +import static org.jclouds.http.HttpUtils.contains404; +import static org.jclouds.util.Throwables2.getFirstThrowableOfType; + import org.jclouds.Fallback; import org.jclouds.openstack.neutron.v2.domain.Ports; import org.jclouds.rest.ResourceNotFoundException; -import static com.google.common.base.Preconditions.checkNotNull; -import static com.google.common.base.Throwables.propagate; -import static com.google.common.util.concurrent.Futures.immediateFuture; -import static org.jclouds.http.HttpUtils.contains404; -import static org.jclouds.util.Throwables2.getFirstThrowableOfType; - public class EmptyPortsFallback implements Fallback { - - public ListenableFuture create(Throwable t) throws Exception { - return immediateFuture(createOrPropagate(t)); - } - @Override public Ports createOrPropagate(Throwable t) throws Exception { if ((getFirstThrowableOfType(checkNotNull(t, "throwable"), ResourceNotFoundException.class) != null) diff --git a/apis/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/fallbacks/EmptyRoutersFallback.java b/apis/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/fallbacks/EmptyRoutersFallback.java index 70195109e0..8b74be2014 100644 --- a/apis/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/fallbacks/EmptyRoutersFallback.java +++ b/apis/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/fallbacks/EmptyRoutersFallback.java @@ -17,23 +17,16 @@ package org.jclouds.openstack.neutron.v2.fallbacks; -import com.google.common.util.concurrent.ListenableFuture; +import static com.google.common.base.Preconditions.checkNotNull; +import static com.google.common.base.Throwables.propagate; +import static org.jclouds.http.HttpUtils.contains404; +import static org.jclouds.util.Throwables2.getFirstThrowableOfType; + import org.jclouds.Fallback; import org.jclouds.openstack.neutron.v2.domain.Routers; import org.jclouds.rest.ResourceNotFoundException; -import static com.google.common.base.Preconditions.checkNotNull; -import static com.google.common.base.Throwables.propagate; -import static com.google.common.util.concurrent.Futures.immediateFuture; -import static org.jclouds.http.HttpUtils.contains404; -import static org.jclouds.util.Throwables2.getFirstThrowableOfType; - public class EmptyRoutersFallback implements Fallback { - - public ListenableFuture create(Throwable t) throws Exception { - return immediateFuture(createOrPropagate(t)); - } - @Override public Routers createOrPropagate(Throwable t) throws Exception { if ((getFirstThrowableOfType(checkNotNull(t, "throwable"), ResourceNotFoundException.class) != null) diff --git a/apis/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/fallbacks/EmptyRulesFallback.java b/apis/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/fallbacks/EmptyRulesFallback.java index a559f4fe99..4556f74690 100644 --- a/apis/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/fallbacks/EmptyRulesFallback.java +++ b/apis/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/fallbacks/EmptyRulesFallback.java @@ -19,21 +19,14 @@ package org.jclouds.openstack.neutron.v2.fallbacks; import static com.google.common.base.Preconditions.checkNotNull; import static com.google.common.base.Throwables.propagate; -import static com.google.common.util.concurrent.Futures.immediateFuture; import static org.jclouds.http.HttpUtils.contains404; import static org.jclouds.util.Throwables2.getFirstThrowableOfType; import org.jclouds.Fallback; import org.jclouds.openstack.neutron.v2.domain.Rules; import org.jclouds.rest.ResourceNotFoundException; -import com.google.common.util.concurrent.ListenableFuture; public class EmptyRulesFallback implements Fallback { - - public ListenableFuture create(Throwable t) throws Exception { - return immediateFuture(createOrPropagate(t)); - } - @Override public Rules createOrPropagate(Throwable t) throws Exception { if ((getFirstThrowableOfType(checkNotNull(t, "throwable"), ResourceNotFoundException.class) != null) diff --git a/apis/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/fallbacks/EmptySecurityGroupsFallback.java b/apis/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/fallbacks/EmptySecurityGroupsFallback.java index 5343c3fdea..70a3e379b2 100644 --- a/apis/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/fallbacks/EmptySecurityGroupsFallback.java +++ b/apis/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/fallbacks/EmptySecurityGroupsFallback.java @@ -17,23 +17,16 @@ package org.jclouds.openstack.neutron.v2.fallbacks; -import com.google.common.util.concurrent.ListenableFuture; +import static com.google.common.base.Preconditions.checkNotNull; +import static com.google.common.base.Throwables.propagate; +import static org.jclouds.http.HttpUtils.contains404; +import static org.jclouds.util.Throwables2.getFirstThrowableOfType; + import org.jclouds.Fallback; import org.jclouds.openstack.neutron.v2.domain.SecurityGroups; import org.jclouds.rest.ResourceNotFoundException; -import static com.google.common.base.Preconditions.checkNotNull; -import static com.google.common.base.Throwables.propagate; -import static com.google.common.util.concurrent.Futures.immediateFuture; -import static org.jclouds.http.HttpUtils.contains404; -import static org.jclouds.util.Throwables2.getFirstThrowableOfType; - public class EmptySecurityGroupsFallback implements Fallback { - - public ListenableFuture create(Throwable t) throws Exception { - return immediateFuture(createOrPropagate(t)); - } - @Override public SecurityGroups createOrPropagate(Throwable t) throws Exception { if ((getFirstThrowableOfType(checkNotNull(t, "throwable"), ResourceNotFoundException.class) != null) diff --git a/apis/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/fallbacks/EmptySubnetsFallback.java b/apis/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/fallbacks/EmptySubnetsFallback.java index 6f8602318e..8f7a94acea 100644 --- a/apis/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/fallbacks/EmptySubnetsFallback.java +++ b/apis/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/fallbacks/EmptySubnetsFallback.java @@ -17,23 +17,16 @@ package org.jclouds.openstack.neutron.v2.fallbacks; -import com.google.common.util.concurrent.ListenableFuture; +import static com.google.common.base.Preconditions.checkNotNull; +import static com.google.common.base.Throwables.propagate; +import static org.jclouds.http.HttpUtils.contains404; +import static org.jclouds.util.Throwables2.getFirstThrowableOfType; + import org.jclouds.Fallback; import org.jclouds.openstack.neutron.v2.domain.Subnets; import org.jclouds.rest.ResourceNotFoundException; -import static com.google.common.base.Preconditions.checkNotNull; -import static com.google.common.base.Throwables.propagate; -import static com.google.common.util.concurrent.Futures.immediateFuture; -import static org.jclouds.http.HttpUtils.contains404; -import static org.jclouds.util.Throwables2.getFirstThrowableOfType; - public class EmptySubnetsFallback implements Fallback { - - public ListenableFuture create(Throwable t) throws Exception { - return immediateFuture(createOrPropagate(t)); - } - @Override public Subnets createOrPropagate(Throwable t) throws Exception { if ((getFirstThrowableOfType(checkNotNull(t, "throwable"), ResourceNotFoundException.class) != null) diff --git a/apis/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/fallbacks/lbaas/v1/EmptyHealthMonitorsFallback.java b/apis/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/fallbacks/lbaas/v1/EmptyHealthMonitorsFallback.java index f298a9c633..8364fba1b3 100644 --- a/apis/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/fallbacks/lbaas/v1/EmptyHealthMonitorsFallback.java +++ b/apis/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/fallbacks/lbaas/v1/EmptyHealthMonitorsFallback.java @@ -19,7 +19,6 @@ package org.jclouds.openstack.neutron.v2.fallbacks.lbaas.v1; import static com.google.common.base.Preconditions.checkNotNull; import static com.google.common.base.Throwables.propagate; -import static com.google.common.util.concurrent.Futures.immediateFuture; import static org.jclouds.http.HttpUtils.contains404; import static org.jclouds.util.Throwables2.getFirstThrowableOfType; @@ -27,14 +26,7 @@ import org.jclouds.Fallback; import org.jclouds.openstack.neutron.v2.domain.lbaas.v1.HealthMonitors; import org.jclouds.rest.ResourceNotFoundException; -import com.google.common.util.concurrent.ListenableFuture; - public class EmptyHealthMonitorsFallback implements Fallback { - - public ListenableFuture create(Throwable t) throws Exception { - return immediateFuture(createOrPropagate(t)); - } - @Override public HealthMonitors createOrPropagate(Throwable t) throws Exception { if ((getFirstThrowableOfType(checkNotNull(t, "throwable"), ResourceNotFoundException.class) != null) diff --git a/apis/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/fallbacks/lbaas/v1/EmptyMembersFallback.java b/apis/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/fallbacks/lbaas/v1/EmptyMembersFallback.java index 1cbc38fcf2..9cb8084272 100644 --- a/apis/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/fallbacks/lbaas/v1/EmptyMembersFallback.java +++ b/apis/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/fallbacks/lbaas/v1/EmptyMembersFallback.java @@ -19,7 +19,6 @@ package org.jclouds.openstack.neutron.v2.fallbacks.lbaas.v1; import static com.google.common.base.Preconditions.checkNotNull; import static com.google.common.base.Throwables.propagate; -import static com.google.common.util.concurrent.Futures.immediateFuture; import static org.jclouds.http.HttpUtils.contains404; import static org.jclouds.util.Throwables2.getFirstThrowableOfType; @@ -27,14 +26,7 @@ import org.jclouds.Fallback; import org.jclouds.openstack.neutron.v2.domain.lbaas.v1.Members; import org.jclouds.rest.ResourceNotFoundException; -import com.google.common.util.concurrent.ListenableFuture; - public class EmptyMembersFallback implements Fallback { - - public ListenableFuture create(Throwable t) throws Exception { - return immediateFuture(createOrPropagate(t)); - } - @Override public Members createOrPropagate(Throwable t) throws Exception { if ((getFirstThrowableOfType(checkNotNull(t, "throwable"), ResourceNotFoundException.class) != null) diff --git a/apis/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/fallbacks/lbaas/v1/EmptyPoolsFallback.java b/apis/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/fallbacks/lbaas/v1/EmptyPoolsFallback.java index 8035c6f78e..0c2ce99969 100644 --- a/apis/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/fallbacks/lbaas/v1/EmptyPoolsFallback.java +++ b/apis/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/fallbacks/lbaas/v1/EmptyPoolsFallback.java @@ -19,7 +19,6 @@ package org.jclouds.openstack.neutron.v2.fallbacks.lbaas.v1; import static com.google.common.base.Preconditions.checkNotNull; import static com.google.common.base.Throwables.propagate; -import static com.google.common.util.concurrent.Futures.immediateFuture; import static org.jclouds.http.HttpUtils.contains404; import static org.jclouds.util.Throwables2.getFirstThrowableOfType; @@ -27,14 +26,7 @@ import org.jclouds.Fallback; import org.jclouds.openstack.neutron.v2.domain.lbaas.v1.Pools; import org.jclouds.rest.ResourceNotFoundException; -import com.google.common.util.concurrent.ListenableFuture; - public class EmptyPoolsFallback implements Fallback { - - public ListenableFuture create(Throwable t) throws Exception { - return immediateFuture(createOrPropagate(t)); - } - @Override public Pools createOrPropagate(Throwable t) throws Exception { if ((getFirstThrowableOfType(checkNotNull(t, "throwable"), ResourceNotFoundException.class) != null) diff --git a/apis/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/fallbacks/lbaas/v1/EmptyVIPsFallback.java b/apis/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/fallbacks/lbaas/v1/EmptyVIPsFallback.java index df3aa90cfb..4dfae2d954 100644 --- a/apis/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/fallbacks/lbaas/v1/EmptyVIPsFallback.java +++ b/apis/openstack-neutron/src/main/java/org/jclouds/openstack/neutron/v2/fallbacks/lbaas/v1/EmptyVIPsFallback.java @@ -19,7 +19,6 @@ package org.jclouds.openstack.neutron.v2.fallbacks.lbaas.v1; import static com.google.common.base.Preconditions.checkNotNull; import static com.google.common.base.Throwables.propagate; -import static com.google.common.util.concurrent.Futures.immediateFuture; import static org.jclouds.http.HttpUtils.contains404; import static org.jclouds.util.Throwables2.getFirstThrowableOfType; @@ -27,14 +26,7 @@ import org.jclouds.Fallback; import org.jclouds.openstack.neutron.v2.domain.lbaas.v1.VIPs; import org.jclouds.rest.ResourceNotFoundException; -import com.google.common.util.concurrent.ListenableFuture; - public class EmptyVIPsFallback implements Fallback { - - public ListenableFuture create(Throwable t) throws Exception { - return immediateFuture(createOrPropagate(t)); - } - @Override public VIPs createOrPropagate(Throwable t) throws Exception { if ((getFirstThrowableOfType(checkNotNull(t, "throwable"), ResourceNotFoundException.class) != null)