mirror of https://github.com/apache/jclouds.git
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.
This commit is contained in:
parent
5c2e2576bf
commit
0ab8ea1bee
|
@ -34,6 +34,7 @@ import javax.inject.Inject;
|
||||||
import javax.inject.Named;
|
import javax.inject.Named;
|
||||||
import javax.inject.Singleton;
|
import javax.inject.Singleton;
|
||||||
|
|
||||||
|
import com.google.common.collect.ForwardingSet;
|
||||||
import org.jclouds.Constants;
|
import org.jclouds.Constants;
|
||||||
import org.jclouds.aws.ec2.compute.config.ClusterCompute;
|
import org.jclouds.aws.ec2.compute.config.ClusterCompute;
|
||||||
import org.jclouds.compute.domain.Image;
|
import org.jclouds.compute.domain.Image;
|
||||||
|
@ -127,7 +128,11 @@ public class AWSEC2ImageSupplier implements Supplier<Set<? extends Image>> {
|
||||||
logger.debug("<< images(%d)", imageMap.size());
|
logger.debug("<< images(%d)", imageMap.size());
|
||||||
|
|
||||||
// TODO Used to be mutable; was this assumed anywhere?
|
// TODO Used to be mutable; was this assumed anywhere?
|
||||||
return ImmutableSet.copyOf(imageMap.values());
|
return new ForwardingSet<Image>() {
|
||||||
|
protected Set<Image> delegate() {
|
||||||
|
return ImmutableSet.copyOf(cache.get().asMap().values());
|
||||||
|
}
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
private Future<Iterable<Image>> images(Iterable<String> regions, String query, String tag) {
|
private Future<Iterable<Image>> images(Iterable<String> regions, String query, String tag) {
|
||||||
|
|
Loading…
Reference in New Issue