diff --git a/apis/cloudloadbalancers/src/main/java/org/jclouds/cloudloadbalancers/loadbalancer/strategy/CloudLoadBalancersListLoadBalancersStrategy.java b/apis/cloudloadbalancers/src/main/java/org/jclouds/cloudloadbalancers/loadbalancer/strategy/CloudLoadBalancersListLoadBalancersStrategy.java index a720ce7855..915468912d 100644 --- a/apis/cloudloadbalancers/src/main/java/org/jclouds/cloudloadbalancers/loadbalancer/strategy/CloudLoadBalancersListLoadBalancersStrategy.java +++ b/apis/cloudloadbalancers/src/main/java/org/jclouds/cloudloadbalancers/loadbalancer/strategy/CloudLoadBalancersListLoadBalancersStrategy.java @@ -72,7 +72,7 @@ public class CloudLoadBalancersListLoadBalancersStrategy implements ListLoadBala @Override public Iterable listLoadBalancers() { - return transform(concat(transformParallel(regions.get(), new Function>>() { + return transform(concat(transformParallel(regions.get(), new Function>>() { @Override public ListenableFuture> apply(String from) { diff --git a/apis/cloudsigma/src/main/java/org/jclouds/cloudsigma/compute/CloudSigmaComputeServiceAdapter.java b/apis/cloudsigma/src/main/java/org/jclouds/cloudsigma/compute/CloudSigmaComputeServiceAdapter.java index 52ade29acf..74327d03b1 100644 --- a/apis/cloudsigma/src/main/java/org/jclouds/cloudsigma/compute/CloudSigmaComputeServiceAdapter.java +++ b/apis/cloudsigma/src/main/java/org/jclouds/cloudsigma/compute/CloudSigmaComputeServiceAdapter.java @@ -56,6 +56,7 @@ import org.jclouds.compute.reference.ComputeServiceConstants; import org.jclouds.domain.Location; import org.jclouds.domain.LoginCredentials; import org.jclouds.logging.Logger; +import org.jclouds.util.Iterables2; import com.google.common.base.Function; import com.google.common.base.Predicate; @@ -170,8 +171,8 @@ public class CloudSigmaComputeServiceAdapter implements */ @Override public Iterable listImages() { - Iterable drives = transformParallel(client.listStandardDrives(), - new Function>() { + Iterable drives = transformParallel(client.listStandardDrives(), + new Function>() { @Override public Future apply(String input) { @@ -190,7 +191,7 @@ public class CloudSigmaComputeServiceAdapter implements return "seedDriveCache()"; } }, executor, null, logger, "drives"); - return filter(drives, PREINSTALLED_DISK); + return Iterables2.concreteCopy(filter(drives, PREINSTALLED_DISK)); } @SuppressWarnings("unchecked") diff --git a/apis/ec2/src/main/java/org/jclouds/ec2/compute/strategy/DescribeImagesParallel.java b/apis/ec2/src/main/java/org/jclouds/ec2/compute/strategy/DescribeImagesParallel.java index 61abb02df1..f080408875 100644 --- a/apis/ec2/src/main/java/org/jclouds/ec2/compute/strategy/DescribeImagesParallel.java +++ b/apis/ec2/src/main/java/org/jclouds/ec2/compute/strategy/DescribeImagesParallel.java @@ -65,7 +65,7 @@ public class DescribeImagesParallel implements Iterable> queries) { return concat(transformParallel( queries, - new Function, Future>>() { + new Function, Future>>() { @Override public Future> apply( diff --git a/apis/ec2/src/main/java/org/jclouds/ec2/compute/strategy/EC2ListNodesStrategy.java b/apis/ec2/src/main/java/org/jclouds/ec2/compute/strategy/EC2ListNodesStrategy.java index 0ac45bd538..2c0d1d01dc 100644 --- a/apis/ec2/src/main/java/org/jclouds/ec2/compute/strategy/EC2ListNodesStrategy.java +++ b/apis/ec2/src/main/java/org/jclouds/ec2/compute/strategy/EC2ListNodesStrategy.java @@ -92,7 +92,7 @@ public class EC2ListNodesStrategy implements ListNodesStrategy { protected Iterable pollRunningInstances() { Iterable>> reservations = transformParallel( - regions.get(), new Function>>>() { + regions.get(), new Function>>>() { @Override public Future>> apply(String from) { diff --git a/apis/elasticstack/src/main/java/org/jclouds/elasticstack/compute/ElasticStackComputeServiceAdapter.java b/apis/elasticstack/src/main/java/org/jclouds/elasticstack/compute/ElasticStackComputeServiceAdapter.java index 6211969d9d..0403679cd4 100644 --- a/apis/elasticstack/src/main/java/org/jclouds/elasticstack/compute/ElasticStackComputeServiceAdapter.java +++ b/apis/elasticstack/src/main/java/org/jclouds/elasticstack/compute/ElasticStackComputeServiceAdapter.java @@ -58,6 +58,7 @@ import org.jclouds.elasticstack.domain.ServerStatus; import org.jclouds.elasticstack.domain.WellKnownImage; import org.jclouds.elasticstack.reference.ElasticStackConstants; import org.jclouds.logging.Logger; +import org.jclouds.util.Iterables2; import com.google.common.base.Function; import com.google.common.base.Predicate; @@ -162,11 +163,11 @@ public class ElasticStackComputeServiceAdapter implements */ @Override public Iterable listImages() { - Iterable drives = transformParallel(preinstalledImages.keySet(), - new Function>() { + Iterable drives = transformParallel(preinstalledImages.keySet(), + new Function>() { @Override - public Future apply(String input) { + public Future apply(String input) { try { return Futures.immediateFuture(cache.getUnchecked(input)); } catch (CacheLoader.InvalidCacheLoadException e) { @@ -183,7 +184,7 @@ public class ElasticStackComputeServiceAdapter implements } }, executor, null, logger, "drives"); - return filter(drives, notNull()); + return Iterables2.concreteCopy(filter(drives, notNull())); } @SuppressWarnings("unchecked") diff --git a/apis/vcloud/src/main/java/org/jclouds/vcloud/config/VCloudRestClientModule.java b/apis/vcloud/src/main/java/org/jclouds/vcloud/config/VCloudRestClientModule.java index 486df9b030..a7131c8056 100644 --- a/apis/vcloud/src/main/java/org/jclouds/vcloud/config/VCloudRestClientModule.java +++ b/apis/vcloud/src/main/java/org/jclouds/vcloud/config/VCloudRestClientModule.java @@ -27,12 +27,12 @@ import static com.google.common.collect.Iterables.filter; import static com.google.common.collect.Iterables.getLast; import static com.google.common.collect.Iterables.transform; import static com.google.common.collect.Maps.transformValues; -import static com.google.common.collect.Maps.uniqueIndex; import static org.jclouds.Constants.PROPERTY_API_VERSION; import static org.jclouds.Constants.PROPERTY_SESSION_INTERVAL; import static org.jclouds.rest.config.BinderUtils.bindClientAndAsyncClient; import static org.jclouds.vcloud.reference.VCloudConstants.PROPERTY_VCLOUD_DEFAULT_FENCEMODE; import static org.jclouds.vcloud.reference.VCloudConstants.PROPERTY_VCLOUD_TIMEOUT_TASK_COMPLETED; +import static org.jclouds.util.Maps2.uniqueIndex; import java.net.URI; import java.util.Map; @@ -118,6 +118,7 @@ import com.google.common.cache.CacheLoader; import com.google.common.cache.LoadingCache; import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableMap.Builder; +import com.google.common.collect.Lists; import com.google.inject.Injector; import com.google.inject.Provides; import com.google.inject.Scopes; @@ -285,26 +286,27 @@ public class VCloudRestClientModule extends RestClientModule>> { + Supplier>> { protected final Supplier> orgSupplier; - protected final Function> allCatalogsInOrg; + protected final Function> allCatalogsInOrg; @Inject protected OrgCatalogSupplier(Supplier> orgSupplier, - Function> allCatalogsInOrg) { + Function> allCatalogsInOrg) { this.orgSupplier = orgSupplier; this.allCatalogsInOrg = allCatalogsInOrg; } @Override - public Map> get() { + public Map> get() { return transformValues( transformValues(orgSupplier.get(), allCatalogsInOrg), - new Function, Map>() { + new Function, + Map>() { @Override - public Map apply( - Iterable from) { + public Map apply( + Iterable from) { return uniqueIndex(from, name); } @@ -336,37 +338,37 @@ public class VCloudRestClientModule extends RestClientModule> provideURIToVDC( + protected Supplier> provideURIToVDC( @Named(PROPERTY_SESSION_INTERVAL) long seconds, AtomicReference authException, URItoVDC supplier) { - return new MemoizedRetryOnTimeOutButNotOnAuthorizationExceptionSupplier>( + return new MemoizedRetryOnTimeOutButNotOnAuthorizationExceptionSupplier>( authException, seconds, supplier); } @Singleton - public static class URItoVDC implements Supplier> { - private final Supplier>> orgVDCMap; + public static class URItoVDC implements Supplier> { + private final Supplier>> orgVDCMap; @Inject - URItoVDC(Supplier>> orgVDCMap) { + URItoVDC(Supplier>> orgVDCMap) { this.orgVDCMap = orgVDCMap; } @Override - public Map get() { + public Map get() { return uniqueIndex(concat(transform(orgVDCMap.get().values(), - new Function, Iterable>() { + new Function, Iterable>() { @Override - public Iterable apply( - Map from) { + public Iterable apply( + Map from) { return from.values(); } - })), new Function() { + })), new Function() { @Override - public URI apply(org.jclouds.vcloud.domain.VDC from) { + public URI apply(VDC from) { return from.getHref(); } @@ -445,43 +447,43 @@ public class VCloudRestClientModule extends RestClientModule>> provideOrgCatalogItemMapSupplierCache( + protected Supplier>> provideOrgCatalogItemMapSupplierCache( @Named(PROPERTY_SESSION_INTERVAL) long seconds, AtomicReference authException, OrgCatalogSupplier supplier) { - return new MemoizedRetryOnTimeOutButNotOnAuthorizationExceptionSupplier>>( + return new MemoizedRetryOnTimeOutButNotOnAuthorizationExceptionSupplier>>( authException, seconds, supplier); } @Provides @Singleton - protected Supplier>> provideOrgVDCSupplierCache( + protected Supplier>> provideOrgVDCSupplierCache( @Named(PROPERTY_SESSION_INTERVAL) long seconds, AtomicReference authException, OrgVDCSupplier supplier) { - return new MemoizedRetryOnTimeOutButNotOnAuthorizationExceptionSupplier>>( + return new MemoizedRetryOnTimeOutButNotOnAuthorizationExceptionSupplier>>( authException, seconds, supplier); } @Singleton - public static class OrgVDCSupplier implements Supplier>> { + public static class OrgVDCSupplier implements Supplier>> { protected final Supplier> orgSupplier; - private final Function> allVDCsInOrg; + private final Function> allVDCsInOrg; @Inject protected OrgVDCSupplier(Supplier> orgSupplier, - Function> allVDCsInOrg) { + Function> allVDCsInOrg) { this.orgSupplier = orgSupplier; this.allVDCsInOrg = allVDCsInOrg; } @Override - public Map> get() { + public Map> get() { return transformValues(transformValues(orgSupplier.get(), allVDCsInOrg), - new Function, Map>() { + new Function, Map>() { @Override - public Map apply( - Iterable from) { - return uniqueIndex(from, name); + public Map apply( + Iterable from) { + return uniqueIndex(Lists.newArrayList(from), name); } }); @@ -490,33 +492,33 @@ public class VCloudRestClientModule extends RestClientModule>>> { - protected final Supplier>> catalogSupplier; - protected final Function> allCatalogItemsInCatalog; + Supplier>>> { + protected final Supplier>> catalogSupplier; + protected final Function> allCatalogItemsInCatalog; @Inject protected OrgCatalogItemSupplier( - Supplier>> catalogSupplier, - Function> allCatalogItemsInCatalog) { + Supplier>> catalogSupplier, + Function> allCatalogItemsInCatalog) { this.catalogSupplier = catalogSupplier; this.allCatalogItemsInCatalog = allCatalogItemsInCatalog; } @Override - public Map>> get() { + public Map>> get() { return transformValues( catalogSupplier.get(), - new Function, Map>>() { + new Function, Map>>() { @Override public Map> apply( - Map from) { + Map from) { return transformValues( from, - new Function>() { + new Function>() { @Override - public Map apply(org.jclouds.vcloud.domain.Catalog from) { + public Map apply(Catalog from) { return uniqueIndex(filter(allCatalogItemsInCatalog.apply(from), notNull()), name); } }); @@ -528,10 +530,10 @@ public class VCloudRestClientModule extends RestClientModule>>> provideOrgCatalogItemSupplierCache( + protected Supplier>>> provideOrgCatalogItemSupplierCache( @Named(PROPERTY_SESSION_INTERVAL) long seconds, AtomicReference authException, OrgCatalogItemSupplier supplier) { - return new MemoizedRetryOnTimeOutButNotOnAuthorizationExceptionSupplier>>>( + return new MemoizedRetryOnTimeOutButNotOnAuthorizationExceptionSupplier>>>( authException, seconds, supplier); } diff --git a/apis/vcloud/src/main/java/org/jclouds/vcloud/functions/AllCatalogItemsInCatalog.java b/apis/vcloud/src/main/java/org/jclouds/vcloud/functions/AllCatalogItemsInCatalog.java index 5721275f82..0393f3b96b 100644 --- a/apis/vcloud/src/main/java/org/jclouds/vcloud/functions/AllCatalogItemsInCatalog.java +++ b/apis/vcloud/src/main/java/org/jclouds/vcloud/functions/AllCatalogItemsInCatalog.java @@ -31,6 +31,7 @@ import javax.inject.Singleton; import org.jclouds.Constants; import org.jclouds.logging.Logger; +import org.jclouds.util.Iterables2; import org.jclouds.vcloud.VCloudAsyncClient; import org.jclouds.vcloud.VCloudMediaType; import org.jclouds.vcloud.domain.Catalog; @@ -60,14 +61,14 @@ public class AllCatalogItemsInCatalog implements Function apply(Catalog from) { - Iterable catalogItems = transformParallel(filter(from.values(), new Predicate() { + Iterable catalogItems = transformParallel(filter(from.values(), new Predicate() { @Override public boolean apply(ReferenceType input) { return input.getType().equals(VCloudMediaType.CATALOGITEM_XML); } - }), new Function>() { + }), new Function>() { @Override public Future apply(ReferenceType from) { @@ -75,7 +76,7 @@ public class AllCatalogItemsInCatalog implements Function @Override public Iterable apply(Org from) { return Iterables.concat(Iterables.transform(allCatalogsInOrg.apply(from), - new Function>() { + new Function>() { @Override - public Iterable apply(Catalog from) { + public Iterable apply(Catalog from) { return allCatalogItemsInCatalog.apply(from); } diff --git a/apis/vcloud/src/main/java/org/jclouds/vcloud/functions/AllCatalogsInOrg.java b/apis/vcloud/src/main/java/org/jclouds/vcloud/functions/AllCatalogsInOrg.java index 644b19a970..683209f396 100644 --- a/apis/vcloud/src/main/java/org/jclouds/vcloud/functions/AllCatalogsInOrg.java +++ b/apis/vcloud/src/main/java/org/jclouds/vcloud/functions/AllCatalogsInOrg.java @@ -30,6 +30,7 @@ import javax.inject.Singleton; import org.jclouds.Constants; import org.jclouds.logging.Logger; +import org.jclouds.util.Iterables2; import org.jclouds.vcloud.VCloudAsyncClient; import org.jclouds.vcloud.domain.Catalog; import org.jclouds.vcloud.domain.Org; @@ -56,14 +57,14 @@ public class AllCatalogsInOrg implements Function> { @Override public Iterable apply(final Org org) { - Iterable catalogs = transformParallel(org.getCatalogs().values(), - new Function>() { + Iterable catalogs = transformParallel(org.getCatalogs().values(), + new Function>() { @Override public Future apply(ReferenceType from) { - return (Future) aclient.getCatalogClient().getCatalog(from.getHref()); + return aclient.getCatalogClient().getCatalog(from.getHref()); } }, executor, null, logger, "catalogs in " + org.getName()); - return catalogs; + return Iterables2.concreteCopy(catalogs); } } \ No newline at end of file diff --git a/apis/vcloud/src/main/java/org/jclouds/vcloud/functions/AllVDCsInOrg.java b/apis/vcloud/src/main/java/org/jclouds/vcloud/functions/AllVDCsInOrg.java index 093e9513a3..a65d6d409a 100644 --- a/apis/vcloud/src/main/java/org/jclouds/vcloud/functions/AllVDCsInOrg.java +++ b/apis/vcloud/src/main/java/org/jclouds/vcloud/functions/AllVDCsInOrg.java @@ -30,6 +30,7 @@ import javax.inject.Singleton; import org.jclouds.Constants; import org.jclouds.logging.Logger; +import org.jclouds.util.Iterables2; import org.jclouds.vcloud.VCloudAsyncClient; import org.jclouds.vcloud.domain.Org; import org.jclouds.vcloud.domain.ReferenceType; @@ -41,7 +42,7 @@ import com.google.common.base.Function; * @author Adrian Cole */ @Singleton -public class AllVDCsInOrg implements Function> { +public class AllVDCsInOrg implements Function> { @Resource public Logger logger = Logger.NULL; @@ -58,14 +59,14 @@ public class AllVDCsInOrg implements Function apply(final Org org) { Iterable catalogItems = transformParallel(org.getVDCs().values(), - new Function>() { + new Function>() { @Override - public Future apply(ReferenceType from) { + public Future apply(ReferenceType from) { return aclient.getVDCClient().getVDC(from.getHref()); } }, executor, null, logger, "vdcs in org " + org.getName()); - return catalogItems; + return Iterables2.concreteCopy(catalogItems); } } \ No newline at end of file diff --git a/apis/vcloud/src/main/java/org/jclouds/vcloud/functions/OrgsForLocations.java b/apis/vcloud/src/main/java/org/jclouds/vcloud/functions/OrgsForLocations.java index 2d326a75cc..017d1b19a8 100644 --- a/apis/vcloud/src/main/java/org/jclouds/vcloud/functions/OrgsForLocations.java +++ b/apis/vcloud/src/main/java/org/jclouds/vcloud/functions/OrgsForLocations.java @@ -35,6 +35,7 @@ import org.jclouds.Constants; import org.jclouds.domain.Location; import org.jclouds.domain.LocationScope; import org.jclouds.logging.Logger; +import org.jclouds.util.Iterables2; import org.jclouds.vcloud.VCloudAsyncClient; import org.jclouds.vcloud.domain.Org; @@ -46,7 +47,7 @@ import com.google.common.collect.Sets; * @author Adrian Cole */ @Singleton -public class OrgsForLocations implements Function, Iterable< Org>> { +public class OrgsForLocations implements Function, Iterable> { @Resource public Logger logger = Logger.NULL; private final VCloudAsyncClient aclient; @@ -65,7 +66,7 @@ public class OrgsForLocations implements Function, Iterable< @Override public Iterable apply(Iterable from) { - return transformParallel(Sets.newLinkedHashSet(transform(filter(from, new Predicate() { + return Iterables2.concreteCopy(transformParallel(Sets.newLinkedHashSet(transform(filter(from, new Predicate() { @Override public boolean apply(Location input) { @@ -79,14 +80,14 @@ public class OrgsForLocations implements Function, Iterable< return URI.create(from.getParent().getId()); } - })), new Function>() { + })), new Function>() { @Override public Future apply(URI from) { return aclient.getOrgClient().getOrg(from); } - }, executor, null, logger, "organizations for uris"); + }, executor, null, logger, "organizations for uris")); } } \ No newline at end of file diff --git a/apis/vcloud/src/main/java/org/jclouds/vcloud/functions/OrgsForNames.java b/apis/vcloud/src/main/java/org/jclouds/vcloud/functions/OrgsForNames.java index 96e276e6df..7cf4473db3 100644 --- a/apis/vcloud/src/main/java/org/jclouds/vcloud/functions/OrgsForNames.java +++ b/apis/vcloud/src/main/java/org/jclouds/vcloud/functions/OrgsForNames.java @@ -30,6 +30,7 @@ import javax.inject.Singleton; import org.jclouds.Constants; import org.jclouds.logging.Logger; +import org.jclouds.util.Iterables2; import org.jclouds.vcloud.VCloudAsyncClient; import org.jclouds.vcloud.domain.Org; @@ -53,14 +54,14 @@ public class OrgsForNames implements Function, Iterable> { @Override public Iterable apply(Iterable from) { - return transformParallel(from, new Function>() { + return Iterables2.concreteCopy(transformParallel(from, new Function>() { @Override public Future apply(String from) { return aclient.getOrgClient().findOrgNamed(from); } - }, executor, null, logger, "organizations for names"); + }, executor, null, logger, "organizations for names")); } } \ No newline at end of file diff --git a/apis/vcloud/src/main/java/org/jclouds/vcloud/functions/VAppTemplatesForCatalogItems.java b/apis/vcloud/src/main/java/org/jclouds/vcloud/functions/VAppTemplatesForCatalogItems.java index 239f27a45b..4abf213bb4 100644 --- a/apis/vcloud/src/main/java/org/jclouds/vcloud/functions/VAppTemplatesForCatalogItems.java +++ b/apis/vcloud/src/main/java/org/jclouds/vcloud/functions/VAppTemplatesForCatalogItems.java @@ -36,6 +36,7 @@ import org.jclouds.concurrent.ExceptionParsingListenableFuture; import org.jclouds.concurrent.Futures; import org.jclouds.logging.Logger; import org.jclouds.rest.AuthorizationException; +import org.jclouds.util.Iterables2; import org.jclouds.vcloud.VCloudAsyncClient; import org.jclouds.vcloud.VCloudMediaType; import org.jclouds.vcloud.domain.CatalogItem; @@ -78,14 +79,14 @@ public class VAppTemplatesForCatalogItems implements Function apply(Iterable from) { - return transformParallel(filter(from, new Predicate() { + return Iterables2.concreteCopy(transformParallel(filter(from, new Predicate() { @Override public boolean apply(CatalogItem input) { return input.getEntity().getType().equals(VCloudMediaType.VAPPTEMPLATE_XML); } - }), new Function>() { + }), new Function>() { @Override public Future apply(CatalogItem from) { @@ -94,7 +95,7 @@ public class VAppTemplatesForCatalogItems implements Function> @Override public Iterable apply(Org from) { Iterable catalogs = allCatalogItemsInOrg.apply(from); - Iterable vAppTemplates = vAppTemplatesForCatalogItems.apply(catalogs); + Iterable vAppTemplates = Iterables2.concreteCopy(vAppTemplatesForCatalogItems.apply(catalogs)); return filter(vAppTemplates, and(notNull(), new Predicate(){ //TODO: test this diff --git a/apis/vcloud/src/main/java/org/jclouds/vcloud/suppliers/VAppTemplatesSupplier.java b/apis/vcloud/src/main/java/org/jclouds/vcloud/suppliers/VAppTemplatesSupplier.java index 05cf929c08..b96cbc752f 100644 --- a/apis/vcloud/src/main/java/org/jclouds/vcloud/suppliers/VAppTemplatesSupplier.java +++ b/apis/vcloud/src/main/java/org/jclouds/vcloud/suppliers/VAppTemplatesSupplier.java @@ -69,8 +69,8 @@ public class VAppTemplatesSupplier implements Supplier> { @Override public Set get() { Iterable orgs = checkNotNull(orgMap.get().values(), "orgs"); - Iterable> images = transformParallel(orgs, - new Function>>() { + Iterable> images = transformParallel(orgs, + new Function>>() { @Override public Future> apply(final Org from) { diff --git a/apis/vcloud/src/test/java/org/jclouds/vcloud/internal/BaseVCloudAsyncClientTest.java b/apis/vcloud/src/test/java/org/jclouds/vcloud/internal/BaseVCloudAsyncClientTest.java index 93edd14153..34010695ad 100644 --- a/apis/vcloud/src/test/java/org/jclouds/vcloud/internal/BaseVCloudAsyncClientTest.java +++ b/apis/vcloud/src/test/java/org/jclouds/vcloud/internal/BaseVCloudAsyncClientTest.java @@ -42,6 +42,7 @@ import org.jclouds.vcloud.VCloudMediaType; import org.jclouds.vcloud.VCloudVersionsClient; import org.jclouds.vcloud.config.VCloudRestClientModule; import org.jclouds.vcloud.domain.AllocationModel; +import org.jclouds.vcloud.domain.CatalogItem; import org.jclouds.vcloud.domain.Org; import org.jclouds.vcloud.domain.ReferenceType; import org.jclouds.vcloud.domain.Task; @@ -253,11 +254,11 @@ public abstract class BaseVCloudAsyncClientTest extends BaseAsyncClientTest>> get() { - return ImmutableMap.>> of( + public Map>> get() { + return ImmutableMap.>> of( ORG_REF.getName(), ImmutableMap - .> of(CATALOG_REF - .getName(), ImmutableMap. of( + .> of(CATALOG_REF + .getName(), ImmutableMap. of( "template", new CatalogItemImpl("template", URI .create("https://vcenterprise.bluelock.com/api/v1.0/catalogItem/2"), "description", diff --git a/blobstore/src/main/java/org/jclouds/blobstore/strategy/internal/FetchBlobMetadata.java b/blobstore/src/main/java/org/jclouds/blobstore/strategy/internal/FetchBlobMetadata.java index 613ff0a888..3980f89349 100644 --- a/blobstore/src/main/java/org/jclouds/blobstore/strategy/internal/FetchBlobMetadata.java +++ b/blobstore/src/main/java/org/jclouds/blobstore/strategy/internal/FetchBlobMetadata.java @@ -42,6 +42,7 @@ import org.jclouds.logging.Logger; import com.google.common.base.Function; import com.google.common.base.Predicate; import com.google.common.collect.Iterables; +import com.google.common.collect.Lists; import com.google.inject.Inject; /** @@ -83,21 +84,21 @@ public class FetchBlobMetadata implements Function apply(PageSet in) { checkState(container != null, "container name should be initialized"); - Iterable returnv = transformParallel(Iterables.filter(in, new Predicate() { + Iterable returnv = Lists.newArrayList(transformParallel(Iterables.filter(in, new Predicate() { @Override public boolean apply(StorageMetadata input) { return input.getType() == StorageType.BLOB; } - }), new Function>() { + }), new Function>() { @Override public Future apply(StorageMetadata from) { return ablobstore.blobMetadata(container, from.getName()); } - }, userExecutor, maxTime, logger, String.format("getting metadata from containerName: %s", container)); + }, userExecutor, maxTime, logger, String.format("getting metadata from containerName: %s", container))); return new PageSetImpl(returnv, in.getNextMarker()); } diff --git a/blobstore/src/main/java/org/jclouds/blobstore/strategy/internal/GetAllBlobsInListAndRetryOnFailure.java b/blobstore/src/main/java/org/jclouds/blobstore/strategy/internal/GetAllBlobsInListAndRetryOnFailure.java index 00adf8ec71..316a522d0a 100644 --- a/blobstore/src/main/java/org/jclouds/blobstore/strategy/internal/GetAllBlobsInListAndRetryOnFailure.java +++ b/blobstore/src/main/java/org/jclouds/blobstore/strategy/internal/GetAllBlobsInListAndRetryOnFailure.java @@ -75,7 +75,7 @@ public class GetAllBlobsInListAndRetryOnFailure implements GetBlobsInListStrateg public Iterable execute(final String container, ListContainerOptions options) { Iterable list = getAllBlobMetadata.execute(container, options); - return transformParallel(list, new Function>() { + return transformParallel(list, new Function>() { @Override public Future apply(BlobMetadata from) { diff --git a/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/compute/suppliers/VCloudHardwareSupplier.java b/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/compute/suppliers/VCloudHardwareSupplier.java index b0bdee1ca1..bdc97a1847 100644 --- a/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/compute/suppliers/VCloudHardwareSupplier.java +++ b/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/compute/suppliers/VCloudHardwareSupplier.java @@ -69,8 +69,8 @@ public class VCloudHardwareSupplier implements Supplier> @Override public Set get() { Iterable orgs = checkNotNull(orgMap.get().values(), "orgs"); - Iterable> sizes = transformParallel(orgs, - new Function>>() { + Iterable> sizes = transformParallel(orgs, + new Function>>() { @Override public Future> apply(final Org from) { diff --git a/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/compute/suppliers/VCloudImageSupplier.java b/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/compute/suppliers/VCloudImageSupplier.java index d636b15f41..e279a64a15 100644 --- a/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/compute/suppliers/VCloudImageSupplier.java +++ b/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/compute/suppliers/VCloudImageSupplier.java @@ -69,8 +69,8 @@ public class VCloudImageSupplier implements Supplier> { @Override public Set get() { Iterable orgs = checkNotNull(orgMap.get().values(), "orgs"); - Iterable> images = transformParallel(orgs, - new Function>>() { + Iterable> images = transformParallel(orgs, + new Function>>() { @Override public Future> apply(final Org from) { diff --git a/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/functions/AllCatalogItemsInCatalog.java b/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/functions/AllCatalogItemsInCatalog.java index 3740de39d5..effb1375e6 100644 --- a/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/functions/AllCatalogItemsInCatalog.java +++ b/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/functions/AllCatalogItemsInCatalog.java @@ -61,14 +61,14 @@ public class AllCatalogItemsInCatalog implements Function apply(Catalog from) { - Iterable catalogItems = transformParallel(filter(from.values(), new Predicate() { + Iterable catalogItems = transformParallel(filter(from.values(), new Predicate() { @Override public boolean apply(ReferenceType input) { return input.getType().equals(TerremarkVCloudMediaType.CATALOGITEM_XML); } - }), new Function>() { + }), new Function>() { @SuppressWarnings("unchecked") @Override diff --git a/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/functions/AllCatalogsInOrg.java b/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/functions/AllCatalogsInOrg.java index 66e7979822..a2ac27fbbd 100644 --- a/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/functions/AllCatalogsInOrg.java +++ b/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/functions/AllCatalogsInOrg.java @@ -56,8 +56,8 @@ public class AllCatalogsInOrg implements Function apply(final Org org) { - Iterable catalogs = transformParallel(org.getCatalogs().values(), - new Function>() { + Iterable catalogs = transformParallel(org.getCatalogs().values(), + new Function>() { @SuppressWarnings("unchecked") @Override public Future apply(ReferenceType from) { diff --git a/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/functions/AllVDCsInOrg.java b/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/functions/AllVDCsInOrg.java index 3ef54d8389..28307a313e 100644 --- a/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/functions/AllVDCsInOrg.java +++ b/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/functions/AllVDCsInOrg.java @@ -56,12 +56,11 @@ public class AllVDCsInOrg implements Function apply(final Org org) { - Iterable catalogItems = transformParallel(org.getVDCs().values(), - new Function>() { - @SuppressWarnings("unchecked") + Iterable catalogItems = transformParallel(org.getVDCs().values(), + new Function>() { @Override - public Future apply(ReferenceType from) { - return (Future) aclient.getVDC(from.getHref()); + public Future apply(ReferenceType from) { + return aclient.getVDC(from.getHref()); } }, executor, null, logger, "vdcs in org " + org.getName()); diff --git a/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/functions/OrgsForLocations.java b/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/functions/OrgsForLocations.java index 568203e667..00f79b4ad1 100644 --- a/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/functions/OrgsForLocations.java +++ b/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/functions/OrgsForLocations.java @@ -79,12 +79,10 @@ public class OrgsForLocations implements Function, return URI.create(from.getParent().getId()); } - })), new Function>() { - - @SuppressWarnings("unchecked") + })), new Function>() { @Override - public Future apply(URI from) { - return (Future) aclient.getOrg(from); + public Future apply(URI from) { + return aclient.getOrg(from); } }, executor, null, logger, "organizations for uris"); diff --git a/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/functions/OrgsForNames.java b/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/functions/OrgsForNames.java index 1c95f0e3ae..74084304f4 100644 --- a/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/functions/OrgsForNames.java +++ b/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/functions/OrgsForNames.java @@ -53,12 +53,10 @@ public class OrgsForNames implements Function, Iterable apply(Iterable from) { - return transformParallel(from, new Function>() { - - @SuppressWarnings("unchecked") + return transformParallel(from, new Function>() { @Override - public Future apply(String from) { - return (Future) aclient.findOrgNamed(from); + public Future apply(String from) { + return aclient.findOrgNamed(from); } }, executor, null, logger, "organizations for names"); diff --git a/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/functions/VAppTemplatesForCatalogItems.java b/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/functions/VAppTemplatesForCatalogItems.java index 6995b71f88..2fbabe474e 100644 --- a/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/functions/VAppTemplatesForCatalogItems.java +++ b/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/functions/VAppTemplatesForCatalogItems.java @@ -68,12 +68,10 @@ public class VAppTemplatesForCatalogItems implements return input.getEntity().getType().equals(TerremarkVCloudMediaType.VAPPTEMPLATE_XML); } - }), new Function>() { - - @SuppressWarnings("unchecked") + }), new Function>() { @Override - public Future apply(CatalogItem from) { - return (Future) aclient.getVAppTemplate(from.getEntity().getHref()); + public Future apply(CatalogItem from) { + return aclient.getVAppTemplate(from.getEntity().getHref()); } }, executor, null, logger, "vappTemplates in"); diff --git a/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/functions/VAppTemplatesForResourceEntities.java b/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/functions/VAppTemplatesForResourceEntities.java index e096c28944..ee9bb1aa6c 100644 --- a/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/functions/VAppTemplatesForResourceEntities.java +++ b/common/trmk/src/main/java/org/jclouds/trmk/vcloud_0_8/functions/VAppTemplatesForResourceEntities.java @@ -69,12 +69,10 @@ public class VAppTemplatesForResourceEntities implements return input.getType().equals(TerremarkVCloudMediaType.VAPPTEMPLATE_XML); } - }), new Function>() { - - @SuppressWarnings("unchecked") + }), new Function>() { @Override - public Future apply(ReferenceType from) { - return (Future) aclient.getVAppTemplate(from.getHref()); + public Future apply(ReferenceType from) { + return aclient.getVAppTemplate(from.getHref()); } }, executor, null, logger, "vappTemplates in"); diff --git a/compute/src/main/java/org/jclouds/compute/internal/BaseComputeService.java b/compute/src/main/java/org/jclouds/compute/internal/BaseComputeService.java index bd4496b219..cd09cf8cfd 100644 --- a/compute/src/main/java/org/jclouds/compute/internal/BaseComputeService.java +++ b/compute/src/main/java/org/jclouds/compute/internal/BaseComputeService.java @@ -238,7 +238,7 @@ public class BaseComputeService implements ComputeService { public Set destroyNodesMatching(Predicate filter) { logger.debug(">> destroying nodes matching(%s)", filter); Set set = newLinkedHashSet(filter(transformParallel(nodesMatchingFilterAndNotTerminated(filter), - new Function>() { + new Function>() { // TODO make an async interface instead of re-wrapping @Override @@ -403,7 +403,7 @@ public class BaseComputeService implements ComputeService { public void rebootNodesMatching(Predicate filter) { logger.debug(">> rebooting nodes matching(%s)", filter); transformParallel(nodesMatchingFilterAndNotTerminatedExceptionIfNotFound(filter), - new Function>() { + new Function>() { // TODO use native async @Override public Future apply(NodeMetadata from) { @@ -434,7 +434,7 @@ public class BaseComputeService implements ComputeService { public void resumeNodesMatching(Predicate filter) { logger.debug(">> resuming nodes matching(%s)", filter); transformParallel(nodesMatchingFilterAndNotTerminatedExceptionIfNotFound(filter), - new Function>() { + new Function>() { // TODO use native async @Override public Future apply(NodeMetadata from) { @@ -465,7 +465,7 @@ public class BaseComputeService implements ComputeService { public void suspendNodesMatching(Predicate filter) { logger.debug(">> suspending nodes matching(%s)", filter); transformParallel(nodesMatchingFilterAndNotTerminatedExceptionIfNotFound(filter), - new Function>() { + new Function>() { // TODO use native async @Override public Future apply(NodeMetadata from) { @@ -649,7 +649,7 @@ public class BaseComputeService implements ComputeService { } private final class TransformNodesIntoInitializedScriptRunners implements - Function> { + Function> { private final Map badNodes; private final Statement script; private final RunScriptOptions options; diff --git a/core/src/main/java/org/jclouds/concurrent/FutureIterables.java b/core/src/main/java/org/jclouds/concurrent/FutureIterables.java index 5fe767144c..2655df9dff 100644 --- a/core/src/main/java/org/jclouds/concurrent/FutureIterables.java +++ b/core/src/main/java/org/jclouds/concurrent/FutureIterables.java @@ -58,50 +58,51 @@ import com.google.inject.Inject; public class FutureIterables { @Resource private static Logger logger = Logger.CONSOLE; - + @Inject(optional = true) @Named(Constants.PROPERTY_MAX_RETRIES) private static int maxRetries = 5; - + @Inject(optional = true) @Named(Constants.PROPERTY_RETRY_DELAY_START) private static long delayStart = 50L; - + @Inject(optional = true) private static BackoffLimitedRetryHandler retryHandler = BackoffLimitedRetryHandler.INSTANCE; - + public static Iterable transformParallel(final Iterable fromIterable, - final Function> function) { + final Function> function) { return transformParallel(fromIterable, function, org.jclouds.concurrent.MoreExecutors.sameThreadExecutor(), null); } - + public static Iterable transformParallel(final Iterable fromIterable, - final Function> function, ExecutorService exec, @Nullable Long maxTime) { + final Function> function, ExecutorService exec, @Nullable Long maxTime) { return transformParallel(fromIterable, function, exec, maxTime, logger, "transforming"); } - + public static Iterable transformParallel(final Iterable fromIterable, - final Function> function, ExecutorService exec, @Nullable Long maxTime, Logger logger, - String logPrefix) { + final Function> function, ExecutorService exec, @Nullable Long maxTime, Logger logger, + String logPrefix) { return transformParallel(fromIterable, function, exec, maxTime, logger, logPrefix, retryHandler, maxRetries); } - + @SuppressWarnings("unchecked") public static Iterable transformParallel(Iterable fromIterable, - Function> function, ExecutorService exec, @Nullable Long maxTime, Logger logger, - String logPrefix, BackoffLimitedRetryHandler retryHandler, int maxRetries) { + Function> function, ExecutorService exec, @Nullable Long maxTime, Logger logger, + String logPrefix, BackoffLimitedRetryHandler retryHandler, int maxRetries) { Map exceptions = newHashMap(); - Map> responses = newHashMap(); + Map> responses = newHashMap(); for (int i = 0; i < maxRetries; i++) { - + for (F from : fromIterable) { - responses.put(from, function.apply(from)); + Future to = function.apply(from); + responses.put(from, to); } exceptions = awaitCompletion(responses, exec, maxTime, logger, logPrefix); if (exceptions.size() > 0 && !any(exceptions.values(), containsThrowable(AuthorizationException.class))) { fromIterable = exceptions.keySet(); retryHandler.imposeBackoffExponentialDelay(delayStart, 2, i + 1, maxRetries, - String.format("error %s: %s: %s", logPrefix, fromIterable, exceptions)); + String.format("error %s: %s: %s", logPrefix, fromIterable, exceptions)); } else { break; } @@ -109,13 +110,13 @@ public class FutureIterables { //make sure we propagate any authorization exception so that we don't lock out accounts if (exceptions.size() > 0) return propagateAuthorizationOrOriginalException(new TransformParallelException((Map) responses, exceptions, - logPrefix)); - + logPrefix)); + return unwrap(responses.values()); } - + public static Map awaitCompletion(Map> responses, ExecutorService exec, - @Nullable Long maxTime, final Logger logger, final String logPrefix) { + @Nullable Long maxTime, final Logger logger, final String logPrefix) { final ConcurrentMap errorMap = newConcurrentMap(); if (responses.size() == 0) return errorMap; @@ -126,7 +127,7 @@ public class FutureIterables { final long start = System.currentTimeMillis(); for (final java.util.Map.Entry> future : responses.entrySet()) { Futures.makeListenable(future.getValue(), exec).addListener(new Runnable() { - + @Override public void run() { try { @@ -168,11 +169,11 @@ public class FutureIterables { } return errorMap; } - - public static Iterable unwrap(Iterable> values) { - return transform(values, new Function, T>() { + + public static Iterable unwrap(Iterable> values) { + return transform(values, new Function, T>() { @Override - public T apply(Future from) { + public T apply(Future from) { try { return from.get(); } catch (InterruptedException e) { @@ -189,20 +190,20 @@ public class FutureIterables { } }); } - + private static void logException(Logger logger, String logPrefix, int total, int complete, int errors, long start, - Exception e) { + Exception e) { String message = message(logPrefix, total, complete, errors, start); logger.error(e, message); } - + private static String message(String prefix, int size, int complete, int errors, long start) { return String.format("%s, completed: %d/%d, errors: %d, rate: %dms/op", prefix, complete, size, errors, - (long) ((System.currentTimeMillis() - start) / ((double) size))); + (long) ((System.currentTimeMillis() - start) / ((double) size))); } - + protected static boolean timeOut(long start, Long maxTime) { return maxTime != null ? System.currentTimeMillis() < start + maxTime : false; } - + } \ No newline at end of file diff --git a/core/src/main/java/org/jclouds/util/Iterables2.java b/core/src/main/java/org/jclouds/util/Iterables2.java new file mode 100644 index 0000000000..886a6d099a --- /dev/null +++ b/core/src/main/java/org/jclouds/util/Iterables2.java @@ -0,0 +1,40 @@ +/** + * Licensed to jclouds, Inc. (jclouds) under one or more + * contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. jclouds licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.jclouds.util; + +import com.google.common.collect.ImmutableSortedSet; + +/** + * General utilities used in jclouds code for {@link Iterable Iterables}. + * + * @author danikov + */ +public class Iterables2 { + + /** + * Copies the contents of a wildcarded {@link Iterable} into a concrete {@link Iterable} of the left bound + * + * @param unboundedValues wildcarded source {@link Iterable} + * @return concrete-typed copy of the source + */ + public static Iterable concreteCopy(Iterable unboundedValues) { + return ImmutableSortedSet.copyOf(unboundedValues); + } + +} diff --git a/core/src/main/java/org/jclouds/util/Maps2.java b/core/src/main/java/org/jclouds/util/Maps2.java index 8150d8e24e..fed452a6a7 100644 --- a/core/src/main/java/org/jclouds/util/Maps2.java +++ b/core/src/main/java/org/jclouds/util/Maps2.java @@ -154,5 +154,15 @@ public class Maps2 { } return result; } + + /** + * Covariant compatible version + * + * @see {@link Maps#uniqueIndex(Iterable, Function)} + */ + public static ImmutableMap uniqueIndex( + Iterable values, Function keyFunction) { + return uniqueIndex(values, keyFunction); + } } diff --git a/core/src/test/java/org/jclouds/concurrent/FutureIterablesTest.java b/core/src/test/java/org/jclouds/concurrent/FutureIterablesTest.java index 0601ede17b..2071454233 100644 --- a/core/src/test/java/org/jclouds/concurrent/FutureIterablesTest.java +++ b/core/src/test/java/org/jclouds/concurrent/FutureIterablesTest.java @@ -43,7 +43,7 @@ public class FutureIterablesTest { final AtomicInteger counter = new AtomicInteger(); try { - transformParallel(ImmutableSet.of("hello", "goodbye"), new Function>() { + transformParallel(ImmutableSet.of("hello", "goodbye"), new Function>() { @Override public Future apply(String input) { @@ -63,7 +63,7 @@ public class FutureIterablesTest { final AtomicInteger counter = new AtomicInteger(); try { - transformParallel(ImmutableSet.of("hello", "goodbye"), new Function>() { + transformParallel(ImmutableSet.of("hello", "goodbye"), new Function>() { @Override public Future apply(String input) { diff --git a/labs/elb/src/main/java/org/jclouds/elb/loadbalancer/strategy/ELBListLoadBalancersStrategy.java b/labs/elb/src/main/java/org/jclouds/elb/loadbalancer/strategy/ELBListLoadBalancersStrategy.java index 65dc2614cf..b23916edcd 100644 --- a/labs/elb/src/main/java/org/jclouds/elb/loadbalancer/strategy/ELBListLoadBalancersStrategy.java +++ b/labs/elb/src/main/java/org/jclouds/elb/loadbalancer/strategy/ELBListLoadBalancersStrategy.java @@ -74,14 +74,14 @@ public class ELBListLoadBalancersStrategy implements ListLoadBalancersStrategy { } @Override - public Iterable listLoadBalancers() { + public Iterable listLoadBalancers() { Iterable loadBalancers; Set regions = this.regions.get(); if (regions.size() > 0) - loadBalancers = concat(transformParallel(regions, new Function>>() { + loadBalancers = concat(transformParallel(regions, new Function>>() { @Override - public ListenableFuture> apply(String from) { + public ListenableFuture> apply(String from) { return aclient.describeLoadBalancersInRegion(from); } diff --git a/labs/glesys/src/main/java/org/jclouds/glesys/compute/GleSYSComputeServiceAdapter.java b/labs/glesys/src/main/java/org/jclouds/glesys/compute/GleSYSComputeServiceAdapter.java index 1fc9e28cea..386b2c474c 100644 --- a/labs/glesys/src/main/java/org/jclouds/glesys/compute/GleSYSComputeServiceAdapter.java +++ b/labs/glesys/src/main/java/org/jclouds/glesys/compute/GleSYSComputeServiceAdapter.java @@ -62,6 +62,7 @@ import org.jclouds.glesys.options.DestroyServerOptions; import org.jclouds.location.predicates.LocationPredicates; import org.jclouds.logging.Logger; import org.jclouds.predicates.RetryablePredicate; +import org.jclouds.util.Iterables2; import com.google.common.base.Function; import com.google.common.base.Predicate; @@ -196,13 +197,13 @@ public class GleSYSComputeServiceAdapter implements ComputeServiceAdapter listNodes() { - return transformParallel(client.getServerClient().listServers(), new Function>() { + return Iterables2.concreteCopy(transformParallel(client.getServerClient().listServers(), new Function>() { @Override public Future apply(Server from) { return aclient.getServerClient().getServerDetails(from.getId()); } - }, userThreads, null, logger, "server details"); + }, userThreads, null, logger, "server details")); } @Override diff --git a/providers/aws-ec2/src/main/java/org/jclouds/aws/ec2/compute/strategy/AWSEC2ListNodesStrategy.java b/providers/aws-ec2/src/main/java/org/jclouds/aws/ec2/compute/strategy/AWSEC2ListNodesStrategy.java index 8f098247ed..240e616079 100644 --- a/providers/aws-ec2/src/main/java/org/jclouds/aws/ec2/compute/strategy/AWSEC2ListNodesStrategy.java +++ b/providers/aws-ec2/src/main/java/org/jclouds/aws/ec2/compute/strategy/AWSEC2ListNodesStrategy.java @@ -69,12 +69,10 @@ public class AWSEC2ListNodesStrategy extends EC2ListNodesStrategy { @Override protected Iterable pollRunningInstances() { Iterable spots = filter(transform(concat(transformParallel(regions.get(), - new Function>>() { - - @SuppressWarnings("unchecked") + new Function>>() { @Override - public Future> apply(String from) { - return (Future>) client.getSpotInstanceServices() + public Future> apply(String from) { + return client.getSpotInstanceServices() .describeSpotInstanceRequestsInRegion(from); }