Named Locks using Hazelcast

This module implement named locks using Hazelcast. It provides two implementations, that are distributed and rely on Hazelcast 4.x ISemaphores.

Out of the box “hazelcast” (distributed) named lock implementations are the following:

  • semaphore-hazelcast implemented in org.eclipse.aether.named.hazelcast.HazelcastCPSemaphoreNamedLockFactory that uses Hazelcast backed com.hazelcast.cp.ISemaphore. Full Hazelcast member is used here.
  • semaphore-hazelcast-client implemented in org.eclipse.aether.named.hazelcast.HazelcastClientCPSemaphoreNamedLockFactory that uses Hazelcast Client backed com.hazelcast.cp.ISemaphore. This implementation uses Hazelcast Client, so connection to some existing Hazelcast cluster, and its existence is a requirement.

Open Issues/Notes

  • It only works when Sisu DI is used and not the bundled AetherModule or ServiceLocator (Maven uses Sisu dependency injection).
  • Usage from plugins has not been tested yet.
  • The furnace-maven-plugin does not work this implementation because it uses ServiceLocator instead of dependency injection.


  • Create the directory ${maven.home}/lib/ext/hazelcast/.
  • Modify ${maven.home}/bin/m2.conf by adding load ${maven.home}/lib/ext/hazelcast/*.jar right after the ${maven.conf}/logging line.
  • Copy the following dependency from Maven Central to ${maven.home}/lib/ext/hazelcast/:
  • Optionally configure Hazelcast instance with ${maven.conf}/hazelcast.xml or ${maven.conf}/hazelcast-client.xml (see Hazelcast documentation for possibilities, or, see test resources of this project as starter).
  • Now start a multithreaded Maven build on your project and make sure NamedSyncContextFactory is being used.