diff --git a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/GoogleComputeEngineService.java b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/GoogleComputeEngineService.java index ebb93f51a3..9b68282e54 100644 --- a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/GoogleComputeEngineService.java +++ b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/GoogleComputeEngineService.java @@ -74,6 +74,7 @@ import com.google.common.base.Optional; import com.google.common.base.Predicate; import com.google.common.base.Supplier; import com.google.common.collect.Sets; +import com.google.common.util.concurrent.Atomics; import com.google.common.util.concurrent.ListeningExecutorService; /** @@ -179,7 +180,7 @@ public class GoogleComputeEngineService extends BaseComputeService { } } - AtomicReference operation = new AtomicReference(api.getNetworkApiForProject(project.get()).delete(resourceName)); + AtomicReference operation = Atomics.newReference(api.getNetworkApiForProject(project.get()).delete(resourceName)); retry(operationDonePredicate, operationCompleteCheckTimeout, operationCompleteCheckInterval, MILLISECONDS).apply(operation); diff --git a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/GoogleComputeEngineServiceAdapter.java b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/GoogleComputeEngineServiceAdapter.java index ecc2e639bc..f4495c0b29 100644 --- a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/GoogleComputeEngineServiceAdapter.java +++ b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/GoogleComputeEngineServiceAdapter.java @@ -69,6 +69,7 @@ import com.google.common.base.Supplier; import com.google.common.collect.FluentIterable; import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableSet; +import com.google.common.util.concurrent.Atomics; import com.google.common.util.concurrent.UncheckedTimeoutException; import com.google.inject.Inject; @@ -154,7 +155,7 @@ public class GoogleComputeEngineServiceAdapter implements ComputeServiceAdapter< } // some times the newly created instances are not immediately returned - AtomicReference instance = new AtomicReference(); + AtomicReference instance = Atomics.newReference(); retry(new Predicate>() { @Override @@ -336,7 +337,7 @@ public class GoogleComputeEngineServiceAdapter implements ComputeServiceAdapter< } private void waitOperationDone(Operation operation) { - AtomicReference operationRef = new AtomicReference(operation); + AtomicReference operationRef = Atomics.newReference(operation); // wait for the operation to complete if (!retryOperationDonePredicate.apply(operationRef)) { diff --git a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/config/GoogleComputeEngineServiceContextModule.java b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/config/GoogleComputeEngineServiceContextModule.java index df50b19d4c..071e402eaa 100644 --- a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/config/GoogleComputeEngineServiceContextModule.java +++ b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/config/GoogleComputeEngineServiceContextModule.java @@ -209,7 +209,7 @@ public class GoogleComputeEngineServiceContextModule public Supplier> provideZones( AtomicReference authException, final GoogleComputeEngineApi api, final Function zoneToLocation, - final @UserProject Supplier userProject, + @UserProject final Supplier userProject, @Named(PROPERTY_SESSION_INTERVAL) long seconds) { return MemoizedRetryOnTimeOutButNotOnAuthorizationExceptionSupplier.create(authException, new Supplier>() { @@ -233,7 +233,7 @@ public class GoogleComputeEngineServiceContextModule public Supplier> provideRegions( AtomicReference authException, final GoogleComputeEngineApi api, - final @UserProject Supplier userProject, + @UserProject final Supplier userProject, @Named(PROPERTY_SESSION_INTERVAL) long seconds) { return MemoizedRetryOnTimeOutButNotOnAuthorizationExceptionSupplier.create(authException, new Supplier>() { diff --git a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/extensions/GoogleComputeEngineSecurityGroupExtension.java b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/extensions/GoogleComputeEngineSecurityGroupExtension.java index 71557bb647..7656c76160 100644 --- a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/extensions/GoogleComputeEngineSecurityGroupExtension.java +++ b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/extensions/GoogleComputeEngineSecurityGroupExtension.java @@ -60,6 +60,7 @@ import com.google.common.collect.FluentIterable; import com.google.common.collect.ImmutableSet; import com.google.common.collect.Iterables; import com.google.common.collect.Multimap; +import com.google.common.util.concurrent.Atomics; /** * An extension to compute service to allow for the manipulation of {@link org.jclouds.compute.domain.SecurityGroup}s. Implementation @@ -175,7 +176,7 @@ public class GoogleComputeEngineSecurityGroupExtension implements SecurityGroupE FluentIterable fws = api.getFirewallApiForProject(userProject.get()).list(options).concat(); for (Firewall fw : fws) { - AtomicReference operation = new AtomicReference(api.getFirewallApiForProject(userProject.get()) + AtomicReference operation = Atomics.newReference(api.getFirewallApiForProject(userProject.get()) .delete(fw.getName())); retry(operationDonePredicate, operationCompleteCheckTimeout, operationCompleteCheckInterval, @@ -184,7 +185,7 @@ public class GoogleComputeEngineSecurityGroupExtension implements SecurityGroupE checkState(!operation.get().getHttpError().isPresent(), "Could not delete firewall, operation failed" + operation); } - AtomicReference operation = new AtomicReference( + AtomicReference operation = Atomics.newReference( api.getNetworkApiForProject(userProject.get()).delete(id)); retry(operationDonePredicate, operationCompleteCheckTimeout, operationCompleteCheckInterval, @@ -226,7 +227,7 @@ public class GoogleComputeEngineSecurityGroupExtension implements SecurityGroupE } fwOptions.addAllowedRule(ruleBuilder.build()); - AtomicReference operation = new AtomicReference(api.getFirewallApiForProject(userProject + AtomicReference operation = Atomics.newReference(api.getFirewallApiForProject(userProject .get()).createInNetwork( uniqueFwName, group.getUri(), @@ -269,7 +270,7 @@ public class GoogleComputeEngineSecurityGroupExtension implements SecurityGroupE for (Firewall fw : fws) { if (equalsIpPermission(ipPermission).apply(fw)) { - AtomicReference operation = new AtomicReference(api.getFirewallApiForProject(userProject.get()) + AtomicReference operation = Atomics.newReference(api.getFirewallApiForProject(userProject.get()) .delete(fw.getName())); retry(operationDonePredicate, operationCompleteCheckTimeout, operationCompleteCheckInterval, diff --git a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/strategy/CreateNodesWithGroupEncodedIntoNameThenAddToSet.java b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/strategy/CreateNodesWithGroupEncodedIntoNameThenAddToSet.java index 52d807c466..d09e417116 100644 --- a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/strategy/CreateNodesWithGroupEncodedIntoNameThenAddToSet.java +++ b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/compute/strategy/CreateNodesWithGroupEncodedIntoNameThenAddToSet.java @@ -57,6 +57,7 @@ import com.google.common.cache.LoadingCache; import com.google.common.collect.ImmutableSet; import com.google.common.collect.Multimap; import com.google.common.collect.Sets; +import com.google.common.util.concurrent.Atomics; import com.google.common.util.concurrent.ListenableFuture; import com.google.common.util.concurrent.ListeningExecutorService; @@ -166,7 +167,7 @@ public class CreateNodesWithGroupEncodedIntoNameThenAddToSet extends .sourceTags(templateOptions.getTags()) .sourceRanges(of(DEFAULT_INTERNAL_NETWORK_RANGE, EXTERIOR_RANGE)) .targetTags(ImmutableSet.of(name)); - AtomicReference operation = new AtomicReference(firewallApi.createInNetwork( + AtomicReference operation = Atomics.newReference(firewallApi.createInNetwork( firewallOptions.getName(), network.getSelfLink(), firewallOptions)); diff --git a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/config/GoogleComputeEngineHttpApiModule.java b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/config/GoogleComputeEngineHttpApiModule.java index bbf10f040c..10e68e6d31 100644 --- a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/config/GoogleComputeEngineHttpApiModule.java +++ b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/config/GoogleComputeEngineHttpApiModule.java @@ -123,8 +123,8 @@ public class GoogleComputeEngineHttpApiModule extends HttpApiModule provideMachineTypeNameToURIFunction(final @Provider Supplier endpoint, - final @UserProject Supplier userProject) { + public Function provideMachineTypeNameToURIFunction(@Provider final Supplier endpoint, + @UserProject final Supplier userProject) { return new Function() { @Override public URI apply(String input) { @@ -139,8 +139,8 @@ public class GoogleComputeEngineHttpApiModule extends HttpApiModule provideNetworkNameToURIFunction(final @Provider Supplier endpoint, - final @UserProject Supplier userProject) { + public Function provideNetworkNameToURIFunction(@Provider final Supplier endpoint, + @UserProject final Supplier userProject) { return new Function() { @Override public URI apply(String input) { @@ -153,8 +153,8 @@ public class GoogleComputeEngineHttpApiModule extends HttpApiModule provideZoneNameToURIFunction(final @Provider Supplier endpoint, - final @UserProject Supplier userProject) { + public Function provideZoneNameToURIFunction(@Provider final Supplier endpoint, + @UserProject final Supplier userProject) { return new Function() { @Override public URI apply(String input) { @@ -167,8 +167,8 @@ public class GoogleComputeEngineHttpApiModule extends HttpApiModule provideRegionNameToURIFunction(final @Provider Supplier endpoint, - final @UserProject Supplier userProject) { + public Function provideRegionNameToURIFunction(@Provider final Supplier endpoint, + @UserProject final Supplier userProject) { return new Function() { @Override public URI apply(String input) { diff --git a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Metadata.java b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Metadata.java index 66c66362e2..e81e94e223 100644 --- a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Metadata.java +++ b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Metadata.java @@ -137,4 +137,4 @@ public class Metadata { .items(in.getItems()); } } -} \ No newline at end of file +} diff --git a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Quota.java b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Quota.java index 9aec605859..7b036a06cd 100644 --- a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Quota.java +++ b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/domain/Quota.java @@ -149,4 +149,4 @@ public class Quota { return new Builder().metric(quota.getMetric()).usage(quota.getUsage()).limit(quota.getLimit()); } } -} \ No newline at end of file +} diff --git a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/functions/CreateNetworkIfNeeded.java b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/functions/CreateNetworkIfNeeded.java index 15057db0c4..4323013d17 100644 --- a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/functions/CreateNetworkIfNeeded.java +++ b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/functions/CreateNetworkIfNeeded.java @@ -41,6 +41,7 @@ import org.jclouds.logging.Logger; import com.google.common.base.Function; import com.google.common.base.Predicate; import com.google.common.base.Supplier; +import com.google.common.util.concurrent.Atomics; /** * @author Andrew Bayer @@ -82,14 +83,14 @@ public class CreateNetworkIfNeeded implements Function operation = new AtomicReference(api.getNetworkApiForProject(userProject + AtomicReference operation = Atomics.newReference(api.getNetworkApiForProject(userProject .get()).createInIPv4RangeWithGateway(input.getName(), input.getIpV4Range(), input.getGateway().get())); retry(operationDonePredicate, operationCompleteCheckTimeout, operationCompleteCheckInterval, MILLISECONDS).apply(operation); checkState(!operation.get().getHttpError().isPresent(), "Could not create network, operation failed" + operation); } else { - AtomicReference operation = new AtomicReference(api.getNetworkApiForProject(userProject + AtomicReference operation = Atomics.newReference(api.getNetworkApiForProject(userProject .get()).createInIPv4Range(input.getName(), input.getIpV4Range())); retry(operationDonePredicate, operationCompleteCheckTimeout, operationCompleteCheckInterval, MILLISECONDS).apply(operation); diff --git a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/handlers/FirewallBinder.java b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/handlers/FirewallBinder.java index 6c3b8b8709..902fbd7fb3 100644 --- a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/handlers/FirewallBinder.java +++ b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/handlers/FirewallBinder.java @@ -56,4 +56,4 @@ public class FirewallBinder implements MapBinder { public R bindToRequest(R request, Object input) { return jsonBinder.bindToRequest(request, input); } -} \ No newline at end of file +} diff --git a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/handlers/RouteBinder.java b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/handlers/RouteBinder.java index e4a1232125..aa89410384 100644 --- a/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/handlers/RouteBinder.java +++ b/providers/google-compute-engine/src/main/java/org/jclouds/googlecomputeengine/handlers/RouteBinder.java @@ -56,4 +56,4 @@ public class RouteBinder implements MapBinder { public R bindToRequest(R request, Object input) { return jsonBinder.bindToRequest(request, input); } -} \ No newline at end of file +}