NEXUS-6232: Backporting it to Nexus 2.7.x

Prevent concurrent execution of createrepo on same data

Original PR
https://github.com/sonatype/nexus-oss/pull/334
Merge pull request #336 from sonatype/nexus-2.7.x-NEXUS-6232

[2.7.x] NEXUS-6232: Backporting it to Nexus 2.7.x