From 0ab8ea1beef7a60917f46317d12c051a29dd0ed4 Mon Sep 17 00:00:00 2001 From: Richard Downer Date: Mon, 9 Jan 2012 10:27:30 +0200 Subject: [PATCH] Change AWSEC2ImageSupplier to return a ForwardingSet, instead of an ImmutableSet. This means the set returned by the Image supplier will reflect changes in the underlying cache. --- .../aws/ec2/compute/suppliers/AWSEC2ImageSupplier.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/providers/aws-ec2/src/main/java/org/jclouds/aws/ec2/compute/suppliers/AWSEC2ImageSupplier.java b/providers/aws-ec2/src/main/java/org/jclouds/aws/ec2/compute/suppliers/AWSEC2ImageSupplier.java index 2f039873a7..b1dd1d16fe 100644 --- a/providers/aws-ec2/src/main/java/org/jclouds/aws/ec2/compute/suppliers/AWSEC2ImageSupplier.java +++ b/providers/aws-ec2/src/main/java/org/jclouds/aws/ec2/compute/suppliers/AWSEC2ImageSupplier.java @@ -34,6 +34,7 @@ import javax.inject.Inject; import javax.inject.Named; import javax.inject.Singleton; +import com.google.common.collect.ForwardingSet; import org.jclouds.Constants; import org.jclouds.aws.ec2.compute.config.ClusterCompute; import org.jclouds.compute.domain.Image; @@ -127,7 +128,11 @@ public class AWSEC2ImageSupplier implements Supplier> { logger.debug("<< images(%d)", imageMap.size()); // TODO Used to be mutable; was this assumed anywhere? - return ImmutableSet.copyOf(imageMap.values()); + return new ForwardingSet() { + protected Set delegate() { + return ImmutableSet.copyOf(cache.get().asMap().values()); + } + }; } private Future> images(Iterable regions, String query, String tag) {