> + * Instantiate the ThreadLocal variables when this thread runs for the
> first time.
> + * Instantiating this in the constructor will not work (different
> thread).
> + */
> + if(blobStore.get() == null) {
> + // It is usually a good idea to include the currentThread when
> logging parallel tasks.
> + System.out.println("Creating connection for thread " +
> Thread.currentThread());
> + /**
> + * In some cases, especially when running very large jobs with many
> parallel threads, some connections will
> + * break. In that case, we need to be able to obtain a new
> connection (and socket) to the service, which is
> + * why this is factored out.
> + */
> + resetBlobstore(username, password, provider, region);
> + }
> +
> + if(container.get() == null) {
> + container.set(UUID.randomUUID().toString());
I should probably add some comments to clarify why UUID.
You want a randomized container name (for aws). You also want a container per
thread (makes this much simpler to use with other providers and in code). Does
this make sense?
---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds-examples/pull/69/files#r22902058