Class AbstractSoftLockManager

  • All Implemented Interfaces:
    SoftLockManager
    Direct Known Subclasses:
    SoftLockManagerImpl

    public abstract class AbstractSoftLockManager
    extends java.lang.Object
    implements SoftLockManager
    An abstract map backed soft lock manager.
    Author:
    Chris Dennis
    • Constructor Detail

      • AbstractSoftLockManager

        public AbstractSoftLockManager​(java.lang.String cacheName,
                                       SoftLockFactory lockFactory)
        Create an abstract soft lock manager for the given cache name and soft lock factory.
        Parameters:
        cacheName - name of the cache
        lockFactory - factory of managed locks
    • Method Detail

      • getAllLocks

        protected abstract java.util.concurrent.ConcurrentMap<SoftLockID,​SoftLock> getAllLocks()
        Return the map of all soft locks.
        Returns:
        the map of all locks
      • getNewKeyLocks

        protected abstract java.util.concurrent.ConcurrentMap<SoftLockID,​java.lang.Boolean> getNewKeyLocks()
        Return the map of all locks that are for new keys.
        Returns:
        the map of all new key locks
      • createSoftLockID

        public SoftLockID createSoftLockID​(TransactionID transactionID,
                                           java.lang.Object key,
                                           Element newElement,
                                           Element oldElement)
        Create a new soft lock ID and associated soft lock if necessary.
        Specified by:
        createSoftLockID in interface SoftLockManager
        Parameters:
        transactionID - the transaction ID under which the soft lock will operate
        key - the key of the Element this soft lock is protecting
        newElement - the new Element
        oldElement - the actual Element
        Returns:
        the soft lock ID
      • findSoftLockById

        public SoftLock findSoftLockById​(SoftLockID softLockId)
        Find a previously created and still existing soft lock
        Specified by:
        findSoftLockById in interface SoftLockManager
        Parameters:
        softLockId - the soft lock's ID
        Returns:
        the soft lock, or null if no soft lock with the corresponding ID could be found
      • getKeysInvisibleInContext

        public java.util.Set<java.lang.Object> getKeysInvisibleInContext​(LocalTransactionContext currentTransactionContext,
                                                                         Store underlyingStore)
        Get a Set of keys protected by soft locks which must not be visible to a transaction context according to the isolation level.
        Specified by:
        getKeysInvisibleInContext in interface SoftLockManager
        Parameters:
        currentTransactionContext - the transaction context
        Returns:
        a Set of keys invisible to the context
      • clearSoftLock

        public void clearSoftLock​(SoftLock softLock)
        Clear a soft lock
        Specified by:
        clearSoftLock in interface SoftLockManager
        Parameters:
        softLock - the lock to clear