[2.7.x] 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

CI
https://bamboo.zion.sonatype.com/browse/NX-OSSF8