Bram, you cannot use the BlobStoreContext or BlobStore view after
closing it.  Closing destroys the ExecutorService that clearContainer
uses to issue asynchronous operations.  The filesystem provider does not
use asynchronous operations and thus does not have this issue.  In the
future jclouds will remove its ExecutorService and require that callers
provide an external one for asynchronous calls like clearContainer.

On Fri, Jun 10, 2016 at 12:45:41PM +0000, Bram Pouwelse wrote:
> Hi,
> 
> I'm running into some never ending integration tests in my prohect after
> upgrading jcouds to 1.9.2, this seems to be caused by calling
> BlobStore#clearContainer after the BlobStoreContext has been closed. I've
> attached a patch to demonstrate this issue using the
> org.jclouds.blobstore.integration.TransientServiceIntegrationTest at the
> end of this mail.
> 
> After figuring out the root cause of my problem I did some more tests and I
> don't really get what the close method is supposed to do, If I try the same
> using the filesystem provider there is no issue? How is it possible the
> BlobStoreContext (and BlobStore instances created from that context) are
> still usable after closing the context?
> 
> Regards,
> Bram
> 
> Patch (tested on the 1.9.x branch):
> 
> diff --git
> a/blobstore/src/test/java/org/jclouds/blobstore/integration/TransientBlobIntegrationTest.java
> b/blobstore/src/test/java/org/jclouds/blobstore/integration/TransientBlobIntegrationTest.java
> index eeaaf96..e63cef6 100644
> ---
> a/blobstore/src/test/java/org/jclouds/blobstore/integration/TransientBlobIntegrationTest.java
> +++
> b/blobstore/src/test/java/org/jclouds/blobstore/integration/TransientBlobIntegrationTest.java
> @@ -16,6 +16,8 @@
>   */
>  package org.jclouds.blobstore.integration;
> 
> +import org.jclouds.blobstore.BlobStore;
> +
>  import org.jclouds.blobstore.integration.internal.BaseBlobIntegrationTest;
>  import org.testng.annotations.Test;
> 
> @@ -24,4 +26,13 @@ public class TransientBlobIntegrationTest extends
> BaseBlobIntegrationTest {
>     public TransientBlobIntegrationTest() {
>        provider = "transient";
>     }
> +
> +   @Test(groups = { "integration"})
> +   public void testClearContainerAfterCloseNeverEnds() throws Exception {
> +        BlobStore blobStore = view.getBlobStore();
> +        blobStore.createContainerInLocation(null, "test");
> +        blobStore.putBlob("test",
> blobStore.blobBuilder("dummy").payload("test".getBytes()).build());
> +    view.close();
> +        blobStore.clearContainer("test");
> +   }
>  }

-- 
Andrew Gaul
http://gaul.org/

Reply via email to