Named Locks

Named locks are essentially locks that are assigned to some given (opaque) ID. If you work with multiple resources that each can have unique ID assigned (file w/ file an absolute path, some entities with unique ID), then you can use named locks to make sure they are being protected from concurrent read and write actions.

Named locks provide support classes for implementations, and provide out of the box two named lock implementation.

Out of the box “local” (local to JVM) named lock implementations are following:

  • rwlock-local implemented in org.eclipse.aether.named.providers.LocalReadWriteLockNamedLockFactory that uses JVM java.util.concurrent.locks.ReentrantReadWriteLock.
  • semaphore-local implemented in org.eclipse.aether.named.providers.LocalSemaphoreNamedLockFactory that uses JVM java.util.concurrent.Semaphore.