Interface KeyBasedLockFactory<L>

Type Parameters:
L - the lock class. It's left open so that any Lock, Semaphore or ReadWriteLock implementation can be used.
All Known Implementing Classes:
AbstractWeakKeyBasedLockFactory, WeakKeyBasedReentrantLockFactory

public interface KeyBasedLockFactory<L>
Factory for getting locks that can be used for concurrent thread synchronization based on keys.
Since:
3.1.5
Author:
avasquez
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns a lock for the specified key.
  • Method Details

    • getLock

      L getLock(Object key)
      Returns a lock for the specified key. Implementations will normally do the following: when the first thread calls this method with a key, a new lock is created and returned. When a second, third and so on concurrent thread tries to get a lock for the same key, the first lock is returned, thus allowing synchronization based on the key.
      Parameters:
      key - the key associated with the lock
      Returns:
      the lock