> @@ -149,7 +149,8 @@ protected String createOrImportKeyPair(String region, 
> String group, TemplateOpti
>        RegionAndName regionAndGroup = new RegionAndName(region, group);
>        KeyPair keyPair;
>        // make sure that we don't request multiple keys simultaneously
> -      synchronized (credentialsMap) {
> +      // TODO: useless synchronization
> +      /*synchronized (credentialsMap)*/ {

I'm guessing the synchronization is meant to be there to prevent a race 
condition when two threads find `containsKey` to be false and try to invoke the 
put in 
https://github.com/andrewgaul/jclouds/blob/findbugs/apis/ec2/src/main/java/org/jclouds/ec2/compute/strategy/CreateKeyPairAndSecurityGroupsAsNeededAndReturnRunOptions.java#L160

I'm sure you saw that too, so unless I'm missing something it doesn't seem 
obvious to me why we should remove the synchronization.

Perhaps split that out into a separate PR where we can try to get in touch with 
the author and figure out what the intention was?

Any idea why FindBugs flags this up, by the way..?

---
Reply to this email directly or view it on GitHub:
https://github.com/jclouds/jclouds/pull/498/files#r16815927

Reply via email to