> @Provides
> @Singleton
> @Storage
> - protected Supplier<URI>
> provideStorageUrl(RegionIdToURISupplier.Factory factory, @ApiVersion String
> apiVersion) {
> - return
> getLastValueInMap(factory.createForApiTypeAndVersion(ServiceType.OBJECT_STORE,
> apiVersion));
> + protected Supplier<URI>
> provideStorageUrl(RegionIdToURISupplier.Factory factory,
> + @ApiVersion String apiVersion,
> + @Named(LocationConstants.PROPERTY_REGION) String region) {
> +
> + //Get the URI's keyed by their region name
> + Supplier<Map<String, Supplier<URI>>> endpointsSupplier =
> factory.createForApiTypeAndVersion(ServiceType.OBJECT_STORE, apiVersion);
> +
> + //Pick the matching region name (if any) otherwise just return an
> arbitrary URL if no region name is set
> + if (!Strings.isNullOrEmpty(region)) {
> + return getSpecificValueInMap(endpointsSupplier, region);
> + } else {
> + return getLastValueInMap(endpointsSupplier);
Is there some way to make this behaviour more deterministic? This looks like a
recipe for hard-to-reproduce scenarios...
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/31/files#r4841119