From 1bdf8a15881d2dcfa99f72f7e94a0a2de37e5845 Mon Sep 17 00:00:00 2001 From: Adrian Cole Date: Sat, 4 Oct 2014 23:02:37 -0700 Subject: [PATCH] JCLOUDS-40 Remove internal usage of AsyncBlobStore. --- .../blobstore/CloudFilesBlobStore.java | 15 ++-- .../swift/blobstore/SwiftBlobStore.java | 34 ++++++++- .../strategy/internal/FetchBlobMetadata.java | 18 +++-- .../GetAllBlobsInListAndRetryOnFailure.java | 18 +++-- .../MarkersDeleteDirectoryStrategy.java | 20 ++--- .../internal/PutBlobsStrategyImpl.java | 19 +++-- .../blobstore/util/BlobStoreUtils.java | 24 ------ .../blobstore/util/BlobStoreUtilsTest.java | 74 +------------------ .../jclouds/aws/s3/AWSS3ClientLiveTest.java | 15 ---- .../HPCloudObjectStorageBlobStore.java | 27 ++++--- 10 files changed, 104 insertions(+), 160 deletions(-) diff --git a/apis/cloudfiles/src/main/java/org/jclouds/cloudfiles/blobstore/CloudFilesBlobStore.java b/apis/cloudfiles/src/main/java/org/jclouds/cloudfiles/blobstore/CloudFilesBlobStore.java index 7c5979d20b..96a813b96d 100644 --- a/apis/cloudfiles/src/main/java/org/jclouds/cloudfiles/blobstore/CloudFilesBlobStore.java +++ b/apis/cloudfiles/src/main/java/org/jclouds/cloudfiles/blobstore/CloudFilesBlobStore.java @@ -16,9 +16,12 @@ */ package org.jclouds.cloudfiles.blobstore; +import static org.jclouds.Constants.PROPERTY_USER_THREADS; + import java.util.Set; import javax.inject.Inject; +import javax.inject.Named; import javax.inject.Provider; import javax.inject.Singleton; @@ -38,9 +41,10 @@ import org.jclouds.openstack.swift.blobstore.functions.ContainerToResourceList; import org.jclouds.openstack.swift.blobstore.functions.ContainerToResourceMetadata; import org.jclouds.openstack.swift.blobstore.functions.ObjectToBlob; import org.jclouds.openstack.swift.blobstore.functions.ObjectToBlobMetadata; +import org.jclouds.openstack.swift.blobstore.strategy.internal.MultipartUploadStrategy; import com.google.common.base.Supplier; -import org.jclouds.openstack.swift.blobstore.strategy.internal.MultipartUploadStrategy; +import com.google.common.util.concurrent.ListeningExecutorService; @Singleton public class CloudFilesBlobStore extends SwiftBlobStore { @@ -48,7 +52,8 @@ public class CloudFilesBlobStore extends SwiftBlobStore { private EnableCDNAndCache enableCDNAndCache; @Inject - protected CloudFilesBlobStore(BlobStoreContext context, BlobUtils blobUtils, Supplier defaultLocation, + protected CloudFilesBlobStore(@Named(PROPERTY_USER_THREADS) ListeningExecutorService userExecutor, + BlobStoreContext context, BlobUtils blobUtils, Supplier defaultLocation, @Memoized Supplier> locations, CommonSwiftClient sync, ContainerToResourceMetadata container2ResourceMd, BlobStoreListContainerOptionsToListContainerOptions container2ContainerListOptions, @@ -56,9 +61,9 @@ public class CloudFilesBlobStore extends SwiftBlobStore { ObjectToBlobMetadata object2BlobMd, BlobToHttpGetOptions blob2ObjectGetOptions, Provider fetchBlobMetadataProvider, EnableCDNAndCache enableCDNAndCache, Provider multipartUploadStrategy) { - super(context, blobUtils, defaultLocation, locations, sync, container2ResourceMd, container2ContainerListOptions, - container2ResourceList, object2Blob, blob2Object, object2BlobMd, blob2ObjectGetOptions, - fetchBlobMetadataProvider, multipartUploadStrategy); + super(userExecutor, context, blobUtils, defaultLocation, locations, sync, container2ResourceMd, + container2ContainerListOptions, container2ResourceList, object2Blob, blob2Object, object2BlobMd, + blob2ObjectGetOptions, fetchBlobMetadataProvider, multipartUploadStrategy); this.enableCDNAndCache = enableCDNAndCache; } diff --git a/apis/swift/src/main/java/org/jclouds/openstack/swift/blobstore/SwiftBlobStore.java b/apis/swift/src/main/java/org/jclouds/openstack/swift/blobstore/SwiftBlobStore.java index 0448909f2f..1cda9083d7 100644 --- a/apis/swift/src/main/java/org/jclouds/openstack/swift/blobstore/SwiftBlobStore.java +++ b/apis/swift/src/main/java/org/jclouds/openstack/swift/blobstore/SwiftBlobStore.java @@ -18,22 +18,23 @@ package org.jclouds.openstack.swift.blobstore; import static com.google.common.base.Preconditions.checkArgument; import static com.google.common.base.Preconditions.checkNotNull; -import static org.jclouds.blobstore.util.BlobStoreUtils.createParentIfNeededAsync; +import static org.jclouds.Constants.PROPERTY_USER_THREADS; import static org.jclouds.openstack.swift.options.ListContainerOptions.Builder.withPrefix; import java.util.Set; import javax.inject.Inject; +import javax.inject.Named; import javax.inject.Provider; import javax.inject.Singleton; -import com.google.common.annotations.VisibleForTesting; import org.jclouds.blobstore.BlobStoreContext; import org.jclouds.blobstore.domain.Blob; import org.jclouds.blobstore.domain.BlobMetadata; import org.jclouds.blobstore.domain.PageSet; import org.jclouds.blobstore.domain.StorageMetadata; import org.jclouds.blobstore.domain.internal.PageSetImpl; +import org.jclouds.blobstore.functions.BlobName; import org.jclouds.blobstore.functions.BlobToHttpGetOptions; import org.jclouds.blobstore.internal.BaseBlobStore; import org.jclouds.blobstore.options.CreateContainerOptions; @@ -56,13 +57,16 @@ import org.jclouds.openstack.swift.domain.ContainerMetadata; import org.jclouds.openstack.swift.domain.MutableObjectInfoWithMetadata; import org.jclouds.openstack.swift.domain.ObjectInfo; +import com.google.common.annotations.VisibleForTesting; import com.google.common.base.Function; import com.google.common.base.Strings; import com.google.common.base.Supplier; import com.google.common.collect.Iterables; +import com.google.common.util.concurrent.ListeningExecutorService; @Singleton public class SwiftBlobStore extends BaseBlobStore { + private final ListeningExecutorService userExecutor; private final CommonSwiftClient sync; private final ContainerToResourceMetadata container2ResourceMd; private final BlobStoreListContainerOptionsToListContainerOptions container2ContainerListOptions; @@ -75,7 +79,8 @@ public class SwiftBlobStore extends BaseBlobStore { private final Provider multipartUploadStrategy; @Inject - protected SwiftBlobStore(BlobStoreContext context, BlobUtils blobUtils, Supplier defaultLocation, + protected SwiftBlobStore(@Named(PROPERTY_USER_THREADS) ListeningExecutorService userExecutor, + BlobStoreContext context, BlobUtils blobUtils, Supplier defaultLocation, @Memoized Supplier> locations, CommonSwiftClient sync, ContainerToResourceMetadata container2ResourceMd, BlobStoreListContainerOptionsToListContainerOptions container2ContainerListOptions, @@ -84,6 +89,7 @@ public class SwiftBlobStore extends BaseBlobStore { Provider fetchBlobMetadataProvider, Provider multipartUploadStrategy) { super(context, blobUtils, defaultLocation, locations); + this.userExecutor = userExecutor; this.sync = sync; this.container2ResourceMd = container2ResourceMd; this.container2ContainerListOptions = container2ContainerListOptions; @@ -196,10 +202,30 @@ public class SwiftBlobStore extends BaseBlobStore { */ @Override public String putBlob(String container, Blob blob) { - createParentIfNeededAsync(context.getAsyncBlobStore(), container, blob); + createParentIfNeededAsync(container, blob); return sync.putObject(container, blob2Object.apply(blob)); } + private static final BlobName blobName = new BlobName(); + + /** Legacy behavior which will not be carried forward in new blobstores. */ + private void createParentIfNeededAsync(final String containerName, Blob blob) { + checkNotNull(containerName, "container"); + checkNotNull(blob, "blob"); + final String name = blobName.apply(blob); + if (name.indexOf('/') > 0) { + userExecutor.submit(new Runnable() { + @Override public void run() { + createDirectory(containerName, parseDirectoryFromPath(name)); + } + }); + } + } + + private static String parseDirectoryFromPath(String path) { + return checkNotNull(path, "path").substring(0, path.lastIndexOf('/')); + } + /** * This implementation invokes {@link CommonSwiftClient#putObject} * 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 560a8f25b3..79f10a4271 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 @@ -19,11 +19,13 @@ package org.jclouds.blobstore.strategy.internal; import static com.google.common.base.Preconditions.checkState; import static org.jclouds.concurrent.FutureIterables.transformParallel; +import java.util.concurrent.Callable; + import javax.annotation.Resource; import javax.inject.Named; import org.jclouds.Constants; -import org.jclouds.blobstore.AsyncBlobStore; +import org.jclouds.blobstore.BlobStore; import org.jclouds.blobstore.domain.BlobMetadata; import org.jclouds.blobstore.domain.PageSet; import org.jclouds.blobstore.domain.StorageMetadata; @@ -49,7 +51,7 @@ import com.google.inject.Inject; public class FetchBlobMetadata implements Function, PageSet> { protected final BackoffLimitedRetryHandler retryHandler; - protected final AsyncBlobStore ablobstore; + protected final BlobStore blobstore; protected final ListeningExecutorService userExecutor; @Resource @Named(BlobStoreConstants.BLOBSTORE_LOGGER) @@ -64,10 +66,10 @@ public class FetchBlobMetadata implements Function>() { @Override - public ListenableFuture apply(StorageMetadata from) { - return ablobstore.blobMetadata(container, from.getName()); + public ListenableFuture apply(final StorageMetadata from) { + return userExecutor.submit(new Callable() { + @Override public BlobMetadata call() throws Exception { + return blobstore.blobMetadata(container, from.getName()); + } + }); } }, userExecutor, maxTime, logger, String.format("getting metadata from containerName: %s", container))); 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 b163f3eb6c..158c390a3b 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 @@ -18,12 +18,14 @@ package org.jclouds.blobstore.strategy.internal; import static org.jclouds.concurrent.FutureIterables.transformParallel; +import java.util.concurrent.Callable; + import javax.annotation.Resource; import javax.inject.Named; import javax.inject.Singleton; import org.jclouds.Constants; -import org.jclouds.blobstore.AsyncBlobStore; +import org.jclouds.blobstore.BlobStore; import org.jclouds.blobstore.domain.Blob; import org.jclouds.blobstore.domain.BlobMetadata; import org.jclouds.blobstore.options.ListContainerOptions; @@ -47,7 +49,7 @@ public class GetAllBlobsInListAndRetryOnFailure implements GetBlobsInListStrateg protected final ListBlobsInContainer getAllBlobMetadata; protected final BackoffLimitedRetryHandler retryHandler; - protected final AsyncBlobStore ablobstore; + protected final BlobStore blobstore; protected final ListeningExecutorService userExecutor; @Resource @Named(BlobStoreConstants.BLOBSTORE_LOGGER) @@ -61,9 +63,9 @@ public class GetAllBlobsInListAndRetryOnFailure implements GetBlobsInListStrateg @Inject GetAllBlobsInListAndRetryOnFailure(@Named(Constants.PROPERTY_USER_THREADS) ListeningExecutorService userExecutor, - ListBlobsInContainer getAllBlobMetadata, AsyncBlobStore ablobstore, BackoffLimitedRetryHandler retryHandler) { + ListBlobsInContainer getAllBlobMetadata, BlobStore blobstore, BackoffLimitedRetryHandler retryHandler) { this.userExecutor = userExecutor; - this.ablobstore = ablobstore; + this.blobstore = blobstore; this.getAllBlobMetadata = getAllBlobMetadata; this.retryHandler = retryHandler; } @@ -73,8 +75,12 @@ public class GetAllBlobsInListAndRetryOnFailure implements GetBlobsInListStrateg return transformParallel(list, new Function>() { @Override - public ListenableFuture apply(BlobMetadata from) { - return ablobstore.getBlob(container, from.getName()); + public ListenableFuture apply(final BlobMetadata from) { + return userExecutor.submit(new Callable() { + @Override public Blob call() throws Exception { + return blobstore.getBlob(container, from.getName()); + } + }); } }, userExecutor, maxTime, logger, String.format("getting from containerName: %s", container), retryHandler, 3); diff --git a/blobstore/src/main/java/org/jclouds/blobstore/strategy/internal/MarkersDeleteDirectoryStrategy.java b/blobstore/src/main/java/org/jclouds/blobstore/strategy/internal/MarkersDeleteDirectoryStrategy.java index f3b7813790..cf75c21423 100644 --- a/blobstore/src/main/java/org/jclouds/blobstore/strategy/internal/MarkersDeleteDirectoryStrategy.java +++ b/blobstore/src/main/java/org/jclouds/blobstore/strategy/internal/MarkersDeleteDirectoryStrategy.java @@ -21,6 +21,7 @@ import static org.jclouds.concurrent.FutureIterables.awaitCompletion; import java.util.Map; import java.util.Set; +import java.util.concurrent.Callable; import java.util.concurrent.TimeoutException; import javax.annotation.Resource; @@ -28,7 +29,6 @@ import javax.inject.Named; import javax.inject.Singleton; import org.jclouds.Constants; -import org.jclouds.blobstore.AsyncBlobStore; import org.jclouds.blobstore.BlobStore; import org.jclouds.blobstore.internal.BlobRuntimeException; import org.jclouds.blobstore.reference.BlobStoreConstants; @@ -63,7 +63,6 @@ import com.google.inject.Inject; @Singleton public class MarkersDeleteDirectoryStrategy implements DeleteDirectoryStrategy { - private final AsyncBlobStore ablobstore; private final BlobStore blobstore; private final ListeningExecutorService userExecutor; @Resource @@ -77,23 +76,26 @@ public class MarkersDeleteDirectoryStrategy implements DeleteDirectoryStrategy { protected Long maxTime; @Inject - MarkersDeleteDirectoryStrategy( - @Named(Constants.PROPERTY_USER_THREADS) ListeningExecutorService userExecutor, - AsyncBlobStore ablobstore, BlobStore blobstore) { + MarkersDeleteDirectoryStrategy(@Named(Constants.PROPERTY_USER_THREADS) ListeningExecutorService userExecutor, + BlobStore blobstore) { this.userExecutor = userExecutor; - this.ablobstore = ablobstore; this.blobstore = blobstore; } - public void execute(String containerName, String directory) { + public void execute(final String containerName, String directory) { Set names = Sets.newHashSet(); names.add(directory); for (String suffix : BlobStoreConstants.DIRECTORY_SUFFIXES) { names.add(directory + suffix); } Map> responses = Maps.newHashMap(); - for (String name : names) { - responses.put(name, ablobstore.removeBlob(containerName, name)); + for (final String name : names) { + responses.put(name, userExecutor.submit(new Callable() { + @Override public Void call() throws Exception { + blobstore.removeBlob(containerName, name); + return null; + } + })); } String message = String.format("deleting directory %s in containerName: %s", directory, containerName); diff --git a/blobstore/src/main/java/org/jclouds/blobstore/strategy/internal/PutBlobsStrategyImpl.java b/blobstore/src/main/java/org/jclouds/blobstore/strategy/internal/PutBlobsStrategyImpl.java index e72fff0be9..33cf4cbb01 100644 --- a/blobstore/src/main/java/org/jclouds/blobstore/strategy/internal/PutBlobsStrategyImpl.java +++ b/blobstore/src/main/java/org/jclouds/blobstore/strategy/internal/PutBlobsStrategyImpl.java @@ -20,6 +20,7 @@ import static com.google.common.base.Throwables.propagate; import static org.jclouds.concurrent.FutureIterables.awaitCompletion; import java.util.Map; +import java.util.concurrent.Callable; import java.util.concurrent.TimeoutException; import javax.annotation.Resource; @@ -27,7 +28,7 @@ import javax.inject.Named; import javax.inject.Singleton; import org.jclouds.Constants; -import org.jclouds.blobstore.AsyncBlobStore; +import org.jclouds.blobstore.BlobStore; import org.jclouds.blobstore.domain.Blob; import org.jclouds.blobstore.internal.BlobRuntimeException; import org.jclouds.blobstore.reference.BlobStoreConstants; @@ -42,7 +43,7 @@ import com.google.inject.Inject; @Singleton public class PutBlobsStrategyImpl implements PutBlobsStrategy { - private final AsyncBlobStore ablobstore; + private final BlobStore blobstore; private final ListeningExecutorService userExecutor; @Resource @Named(BlobStoreConstants.BLOBSTORE_LOGGER) @@ -56,16 +57,20 @@ public class PutBlobsStrategyImpl implements PutBlobsStrategy { @Inject PutBlobsStrategyImpl(@Named(Constants.PROPERTY_USER_THREADS) ListeningExecutorService userExecutor, - AsyncBlobStore ablobstore) { + BlobStore blobstore) { this.userExecutor = userExecutor; - this.ablobstore = ablobstore; + this.blobstore = blobstore; } @Override - public void execute(String containerName, Iterable blobs) { + public void execute(final String containerName, Iterable blobs) { Map> responses = Maps.newLinkedHashMap(); - for (Blob blob : blobs) { - responses.put(blob, ablobstore.putBlob(containerName, blob)); + for (final Blob blob : blobs) { + responses.put(blob, userExecutor.submit(new Callable() { + @Override public Object call() throws Exception { + return blobstore.putBlob(containerName, blob); + } + })); } Map exceptions; try { diff --git a/blobstore/src/main/java/org/jclouds/blobstore/util/BlobStoreUtils.java b/blobstore/src/main/java/org/jclouds/blobstore/util/BlobStoreUtils.java index e9f81cac7c..c2208ccd5c 100644 --- a/blobstore/src/main/java/org/jclouds/blobstore/util/BlobStoreUtils.java +++ b/blobstore/src/main/java/org/jclouds/blobstore/util/BlobStoreUtils.java @@ -23,18 +23,13 @@ import java.util.Map; import java.util.regex.Matcher; import java.util.regex.Pattern; -import org.jclouds.blobstore.AsyncBlobStore; -import org.jclouds.blobstore.domain.Blob; import org.jclouds.blobstore.domain.MutableBlobMetadata; import org.jclouds.blobstore.domain.internal.MutableBlobMetadataImpl; -import org.jclouds.blobstore.functions.BlobName; import org.jclouds.http.HttpRequest; import org.jclouds.http.HttpRequestFilter; import org.jclouds.rest.internal.GeneratedHttpRequest; import com.google.common.collect.Maps; -import com.google.common.util.concurrent.Futures; -import com.google.common.util.concurrent.ListenableFuture; public class BlobStoreUtils { public static HttpRequest cleanRequest(HttpRequest returnVal) { @@ -45,10 +40,6 @@ public class BlobStoreUtils { .headers(returnVal.getHeaders()).payload(returnVal.getPayload()).build(); } - public static String parseDirectoryFromPath(String path) { - return checkNotNull(path, "path").substring(0, path.lastIndexOf('/')); - } - private static Pattern keyFromContainer = Pattern.compile("/?[^/]+/(.*)"); public static String getNameFor(GeneratedHttpRequest request) { @@ -70,21 +61,6 @@ public class BlobStoreUtils { } return objectKey; } - - private static final BlobName blobName = new BlobName(); - - public static ListenableFuture createParentIfNeededAsync(AsyncBlobStore asyncBlobStore, String container, - Blob blob) { - checkNotNull(asyncBlobStore, "asyncBlobStore"); - checkNotNull(container, "container"); - - String name = blobName.apply(blob); - if (name.indexOf('/') > 0) { - return asyncBlobStore.createDirectory(container, parseDirectoryFromPath(name)); - } else { - return Futures.immediateFuture(null); - } - } public static MutableBlobMetadata copy(MutableBlobMetadata in) { MutableBlobMetadata metadata = new MutableBlobMetadataImpl(in); diff --git a/blobstore/src/test/java/org/jclouds/blobstore/util/BlobStoreUtilsTest.java b/blobstore/src/test/java/org/jclouds/blobstore/util/BlobStoreUtilsTest.java index d412e9d872..30b399beef 100644 --- a/blobstore/src/test/java/org/jclouds/blobstore/util/BlobStoreUtilsTest.java +++ b/blobstore/src/test/java/org/jclouds/blobstore/util/BlobStoreUtilsTest.java @@ -16,11 +16,6 @@ */ package org.jclouds.blobstore.util; -import static org.easymock.EasyMock.createMock; -import static org.easymock.EasyMock.expect; -import static org.easymock.EasyMock.replay; -import static org.easymock.EasyMock.verify; -import static org.jclouds.blobstore.util.BlobStoreUtils.createParentIfNeededAsync; import static org.jclouds.blobstore.util.BlobStoreUtils.getNameFor; import static org.jclouds.reflect.Reflection2.method; import static org.testng.Assert.assertEquals; @@ -28,83 +23,16 @@ import static org.testng.Assert.assertEquals; import java.net.URI; import java.util.List; -import org.jclouds.blobstore.AsyncBlobStore; -import org.jclouds.blobstore.domain.Blob; -import org.jclouds.blobstore.domain.MutableBlobMetadata; import org.jclouds.reflect.Invocation; import org.jclouds.rest.internal.GeneratedHttpRequest; import org.testng.annotations.Test; import com.google.common.base.Throwables; import com.google.common.collect.ImmutableList; -/** - * Tests behavior of {@code BlobStoreUtils} - */ + @Test(groups = "unit") public class BlobStoreUtilsTest { - public void testCreateParentIfNeededAsyncNoPath() { - AsyncBlobStore asyncBlobStore = createMock(AsyncBlobStore.class); - String container = "container"; - Blob blob = createMock(Blob.class); - MutableBlobMetadata md = createMock(MutableBlobMetadata.class); - - expect(blob.getMetadata()).andReturn(md).atLeastOnce(); - expect(md.getName()).andReturn("hello").atLeastOnce(); - - replay(asyncBlobStore); - replay(blob); - replay(md); - - createParentIfNeededAsync(asyncBlobStore, container, blob); - - verify(asyncBlobStore); - verify(blob); - verify(md); - } - - public void testCreateParentIfNeededAsyncSinglePath() { - AsyncBlobStore asyncBlobStore = createMock(AsyncBlobStore.class); - String container = "container"; - Blob blob = createMock(Blob.class); - MutableBlobMetadata md = createMock(MutableBlobMetadata.class); - - expect(blob.getMetadata()).andReturn(md).atLeastOnce(); - expect(md.getName()).andReturn("rootpath/hello").atLeastOnce(); - expect(asyncBlobStore.createDirectory("container", "rootpath")).andReturn(null); - - replay(asyncBlobStore); - replay(blob); - replay(md); - - createParentIfNeededAsync(asyncBlobStore, container, blob); - - verify(asyncBlobStore); - verify(blob); - verify(md); - } - - public void testCreateParentIfNeededAsyncNestedPath() { - AsyncBlobStore asyncBlobStore = createMock(AsyncBlobStore.class); - String container = "container"; - Blob blob = createMock(Blob.class); - MutableBlobMetadata md = createMock(MutableBlobMetadata.class); - - expect(blob.getMetadata()).andReturn(md).atLeastOnce(); - expect(md.getName()).andReturn("rootpath/subpath/hello").atLeastOnce(); - expect(asyncBlobStore.createDirectory("container", "rootpath/subpath")).andReturn(null); - - replay(asyncBlobStore); - replay(blob); - replay(md); - - createParentIfNeededAsync(asyncBlobStore, container, blob); - - verify(asyncBlobStore); - verify(blob); - verify(md); - } - public void testGetKeyForAzureS3AndRackspace() { GeneratedHttpRequest request = requestForEndpointAndArgs( "https://jclouds.blob.core.windows.net/adriancole-blobstore0/five", diff --git a/providers/aws-s3/src/test/java/org/jclouds/aws/s3/AWSS3ClientLiveTest.java b/providers/aws-s3/src/test/java/org/jclouds/aws/s3/AWSS3ClientLiveTest.java index aba8e58960..c0db91977d 100644 --- a/providers/aws-s3/src/test/java/org/jclouds/aws/s3/AWSS3ClientLiveTest.java +++ b/providers/aws-s3/src/test/java/org/jclouds/aws/s3/AWSS3ClientLiveTest.java @@ -33,7 +33,6 @@ import java.util.UUID; import org.jclouds.aws.AWSResponseException; import org.jclouds.aws.domain.Region; import org.jclouds.aws.s3.domain.DeleteResult; -import org.jclouds.blobstore.AsyncBlobStore; import org.jclouds.blobstore.BlobStore; import org.jclouds.blobstore.KeyNotFoundException; import org.jclouds.blobstore.domain.Blob; @@ -146,20 +145,6 @@ public class AWSS3ClientLiveTest extends S3ClientLiveTest { } } - public void testMultipartAsynchronouslySmallBlob() throws IOException, InterruptedException, Exception { - String containerName = getContainerName(); - - try { - AsyncBlobStore asyncBlobStore = view.getAsyncBlobStore(); - asyncBlobStore.createContainerInLocation(null, containerName).get(); - Blob blob = asyncBlobStore.blobBuilder("small").payload("small").build(); - asyncBlobStore.putBlob(containerName, blob, PutOptions.Builder.multipart()).get(); - - } finally { - returnContainer(containerName); - } - } - public void testPutWithReducedRedundancyStorage() throws InterruptedException { String containerName = getContainerName(); try { diff --git a/providers/hpcloud-objectstorage/src/main/java/org/jclouds/hpcloud/objectstorage/blobstore/HPCloudObjectStorageBlobStore.java b/providers/hpcloud-objectstorage/src/main/java/org/jclouds/hpcloud/objectstorage/blobstore/HPCloudObjectStorageBlobStore.java index 564adea120..f7213d4898 100644 --- a/providers/hpcloud-objectstorage/src/main/java/org/jclouds/hpcloud/objectstorage/blobstore/HPCloudObjectStorageBlobStore.java +++ b/providers/hpcloud-objectstorage/src/main/java/org/jclouds/hpcloud/objectstorage/blobstore/HPCloudObjectStorageBlobStore.java @@ -16,9 +16,12 @@ */ package org.jclouds.hpcloud.objectstorage.blobstore; +import static org.jclouds.Constants.PROPERTY_USER_THREADS; + import java.util.Set; import javax.inject.Inject; +import javax.inject.Named; import javax.inject.Provider; import javax.inject.Singleton; @@ -41,6 +44,7 @@ import org.jclouds.openstack.swift.blobstore.functions.ObjectToBlobMetadata; import org.jclouds.openstack.swift.blobstore.strategy.internal.MultipartUploadStrategy; import com.google.common.base.Supplier; +import com.google.common.util.concurrent.ListeningExecutorService; @Singleton public class HPCloudObjectStorageBlobStore extends SwiftBlobStore { @@ -48,17 +52,18 @@ public class HPCloudObjectStorageBlobStore extends SwiftBlobStore { private EnableCDNAndCache enableCDNAndCache; @Inject - protected HPCloudObjectStorageBlobStore(BlobStoreContext context, BlobUtils blobUtils, - Supplier defaultLocation, @Memoized Supplier> locations, - HPCloudObjectStorageApi sync, ContainerToResourceMetadata container2ResourceMd, - BlobStoreListContainerOptionsToListContainerOptions container2ContainerListOptions, - ContainerToResourceList container2ResourceList, ObjectToBlob object2Blob, BlobToObject blob2Object, - ObjectToBlobMetadata object2BlobMd, BlobToHttpGetOptions blob2ObjectGetOptions, - Provider fetchBlobMetadataProvider, EnableCDNAndCache enableCDNAndCache, - Provider multipartUploadStrategy) { - super(context, blobUtils, defaultLocation, locations, sync, container2ResourceMd, container2ContainerListOptions, - container2ResourceList, object2Blob, blob2Object, object2BlobMd, blob2ObjectGetOptions, - fetchBlobMetadataProvider, multipartUploadStrategy); + protected HPCloudObjectStorageBlobStore(@Named(PROPERTY_USER_THREADS) ListeningExecutorService userExecutor, + BlobStoreContext context, BlobUtils blobUtils, Supplier defaultLocation, + @Memoized Supplier> locations, HPCloudObjectStorageApi sync, + ContainerToResourceMetadata container2ResourceMd, + BlobStoreListContainerOptionsToListContainerOptions container2ContainerListOptions, + ContainerToResourceList container2ResourceList, ObjectToBlob object2Blob, BlobToObject blob2Object, + ObjectToBlobMetadata object2BlobMd, BlobToHttpGetOptions blob2ObjectGetOptions, + Provider fetchBlobMetadataProvider, EnableCDNAndCache enableCDNAndCache, + Provider multipartUploadStrategy) { + super(userExecutor, context, blobUtils, defaultLocation, locations, sync, container2ResourceMd, + container2ContainerListOptions, container2ResourceList, object2Blob, blob2Object, object2BlobMd, + blob2ObjectGetOptions, fetchBlobMetadataProvider, multipartUploadStrategy); this.enableCDNAndCache = enableCDNAndCache; }