org.jclouds.compute.suppliers
Class ImageCacheSupplier
java.lang.Object
org.jclouds.compute.suppliers.ImageCacheSupplier
- All Implemented Interfaces:
- com.google.common.base.Supplier<Set<? extends Image>>
@Singleton
public class ImageCacheSupplier
- extends Object
- implements com.google.common.base.Supplier<Set<? extends Image>>
Image supplier that allows new images to be registered.
This is a wrapper for the memoized image supplier (the actual image cache), to provide a way to register new images as
needed. Once a new image is created by the ImageExtension, or discovered by
other means (see https://issues.apache.org/jira/browse/JCLOUDS-570) this supplier will allow the image to be appended
to the cached list, so it can be properly used normally.
|
Constructor Summary |
ImageCacheSupplier(com.google.common.base.Supplier<Set<? extends Image>> imageCache,
long sessionIntervalSeconds)
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ImageCacheSupplier
@Inject
public ImageCacheSupplier(@Named(value="imageCache")
com.google.common.base.Supplier<Set<? extends Image>> imageCache,
@Named(value="jclouds.session-interval")
long sessionIntervalSeconds)
get
public Set<? extends Image> get()
- Specified by:
get in interface com.google.common.base.Supplier<Set<? extends Image>>
registerImage
public void registerImage(Image image)
- Registers a new image in the image cache.
This method should be called to register new images into the image cache, when some image that is known to exist
in the provider is still not cached. For example, this can happen when an image is created after the image cache
has been populated for the first time.
Note that this method does not check if the image is already cached, to avoid loading all images if the image
cache is still not populated.
- Parameters:
image - The image to be registered to the cache.
Copyright © 2009-2014 The Apache Software Foundation. All Rights Reserved.