Address Checkstyle violations

This commit is contained in:
Andrew Gaul 2013-12-01 23:19:24 -08:00
parent aca161fd96
commit 18359aecd5
11 changed files with 29 additions and 24 deletions

View File

@ -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> operation = new AtomicReference<Operation>(api.getNetworkApiForProject(project.get()).delete(resourceName));
AtomicReference<Operation> operation = Atomics.newReference(api.getNetworkApiForProject(project.get()).delete(resourceName));
retry(operationDonePredicate, operationCompleteCheckTimeout, operationCompleteCheckInterval,
MILLISECONDS).apply(operation);

View File

@ -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> instance = new AtomicReference<Instance>();
AtomicReference<Instance> instance = Atomics.newReference();
retry(new Predicate<AtomicReference<Instance>>() {
@Override
@ -336,7 +337,7 @@ public class GoogleComputeEngineServiceAdapter implements ComputeServiceAdapter<
}
private void waitOperationDone(Operation operation) {
AtomicReference<Operation> operationRef = new AtomicReference<Operation>(operation);
AtomicReference<Operation> operationRef = Atomics.newReference(operation);
// wait for the operation to complete
if (!retryOperationDonePredicate.apply(operationRef)) {

View File

@ -209,7 +209,7 @@ public class GoogleComputeEngineServiceContextModule
public Supplier<Map<URI, ? extends Location>> provideZones(
AtomicReference<AuthorizationException> authException,
final GoogleComputeEngineApi api, final Function<Zone, Location> zoneToLocation,
final @UserProject Supplier<String> userProject,
@UserProject final Supplier<String> userProject,
@Named(PROPERTY_SESSION_INTERVAL) long seconds) {
return MemoizedRetryOnTimeOutButNotOnAuthorizationExceptionSupplier.create(authException,
new Supplier<Map<URI, ? extends Location>>() {
@ -233,7 +233,7 @@ public class GoogleComputeEngineServiceContextModule
public Supplier<Map<URI, Region>> provideRegions(
AtomicReference<AuthorizationException> authException,
final GoogleComputeEngineApi api,
final @UserProject Supplier<String> userProject,
@UserProject final Supplier<String> userProject,
@Named(PROPERTY_SESSION_INTERVAL) long seconds) {
return MemoizedRetryOnTimeOutButNotOnAuthorizationExceptionSupplier.create(authException,
new Supplier<Map<URI, Region>>() {

View File

@ -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<Firewall> fws = api.getFirewallApiForProject(userProject.get()).list(options).concat();
for (Firewall fw : fws) {
AtomicReference<Operation> operation = new AtomicReference<Operation>(api.getFirewallApiForProject(userProject.get())
AtomicReference<Operation> 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> operation = new AtomicReference<Operation>(
AtomicReference<Operation> 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> operation = new AtomicReference<Operation>(api.getFirewallApiForProject(userProject
AtomicReference<Operation> 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> operation = new AtomicReference<Operation>(api.getFirewallApiForProject(userProject.get())
AtomicReference<Operation> operation = Atomics.newReference(api.getFirewallApiForProject(userProject.get())
.delete(fw.getName()));
retry(operationDonePredicate, operationCompleteCheckTimeout, operationCompleteCheckInterval,

View File

@ -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> operation = new AtomicReference<Operation>(firewallApi.createInNetwork(
AtomicReference<Operation> operation = Atomics.newReference(firewallApi.createInNetwork(
firewallOptions.getName(),
network.getSelfLink(),
firewallOptions));

View File

@ -123,8 +123,8 @@ public class GoogleComputeEngineHttpApiModule extends HttpApiModule<GoogleComput
@Provides
@Singleton
@Named("machineTypeToURI")
public Function<String, URI> provideMachineTypeNameToURIFunction(final @Provider Supplier<URI> endpoint,
final @UserProject Supplier<String> userProject) {
public Function<String, URI> provideMachineTypeNameToURIFunction(@Provider final Supplier<URI> endpoint,
@UserProject final Supplier<String> userProject) {
return new Function<String, URI>() {
@Override
public URI apply(String input) {
@ -139,8 +139,8 @@ public class GoogleComputeEngineHttpApiModule extends HttpApiModule<GoogleComput
@Provides
@Singleton
@Named("networkToURI")
public Function<String, URI> provideNetworkNameToURIFunction(final @Provider Supplier<URI> endpoint,
final @UserProject Supplier<String> userProject) {
public Function<String, URI> provideNetworkNameToURIFunction(@Provider final Supplier<URI> endpoint,
@UserProject final Supplier<String> userProject) {
return new Function<String, URI>() {
@Override
public URI apply(String input) {
@ -153,8 +153,8 @@ public class GoogleComputeEngineHttpApiModule extends HttpApiModule<GoogleComput
@Provides
@Singleton
@Named("zoneToURI")
public Function<String, URI> provideZoneNameToURIFunction(final @Provider Supplier<URI> endpoint,
final @UserProject Supplier<String> userProject) {
public Function<String, URI> provideZoneNameToURIFunction(@Provider final Supplier<URI> endpoint,
@UserProject final Supplier<String> userProject) {
return new Function<String, URI>() {
@Override
public URI apply(String input) {
@ -167,8 +167,8 @@ public class GoogleComputeEngineHttpApiModule extends HttpApiModule<GoogleComput
@Provides
@Singleton
@Named("regionToURI")
public Function<String, URI> provideRegionNameToURIFunction(final @Provider Supplier<URI> endpoint,
final @UserProject Supplier<String> userProject) {
public Function<String, URI> provideRegionNameToURIFunction(@Provider final Supplier<URI> endpoint,
@UserProject final Supplier<String> userProject) {
return new Function<String, URI>() {
@Override
public URI apply(String input) {

View File

@ -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<NetworkAndAddressRange, N
}
if (input.getGateway().isPresent()) {
AtomicReference<Operation> operation = new AtomicReference<Operation>(api.getNetworkApiForProject(userProject
AtomicReference<Operation> 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> operation = new AtomicReference<Operation>(api.getNetworkApiForProject(userProject
AtomicReference<Operation> operation = Atomics.newReference(api.getNetworkApiForProject(userProject
.get()).createInIPv4Range(input.getName(), input.getIpV4Range()));
retry(operationDonePredicate, operationCompleteCheckTimeout, operationCompleteCheckInterval,
MILLISECONDS).apply(operation);