sonatype/nexus — pull request #10 by mcculls (2011-10-24 22:14:59+00:00)
Title: Nexus-HA: add support for semaphore-based resource locks

This patch adds the ability to switch Nexus resource locking from the current reader-writer lock approach to a semaphore-based approach. Semaphores have some advantages over reader-writer locks in that they can be easily distributed. One thread can also lock/unlock the resource on behalf of another thread, which can help when recovering from deadlocks. The key disadvantage of semaphores is the extra book-keeping required to provide ownership semantics on top of what is essentially an ownerless primitive.

The current configuration leaves the existing lock approach in place. To enable local semaphore resource locking add "sisu-resource-locks = local" to conf/nexus.properties. To enable distributed hazelcast resource locking copy http://search.maven.org/#artifactdetails%7Ccom.hazelcast%7Chazelcast%7C1.9.4.4%7Cjar to nexus/WEB-INF/lib and add "sisu-resource-locks = hazelcast" to conf/nexus.properties

See https://github.com/sonatype/sisu-locks for the local and distributed (hazelcast) lock implementations as well as their associated stress-tests. JMX controls are provided to monitor and manage resource locks; start "jconsole" and attach it to the Nexus process. The controls can be found under the "org.sonatype.sisu" entry.