Class LockDAOImpl

  • All Implemented Interfaces:
    LockDAO

    public class LockDAOImpl
    extends AbstractLockDAOImpl
    iBatis-specific implementation of the Locks DAO.
    Since:
    3.2
    Author:
    Derek Hulley
    • Constructor Detail

      • LockDAOImpl

        public LockDAOImpl()
    • Method Detail

      • setSqlSessionTemplate

        public final void setSqlSessionTemplate​(org.mybatis.spring.SqlSessionTemplate sqlSessionTemplate)
      • getLockResource

        protected LockResourceEntity getLockResource​(java.lang.Long qnameNamespaceId,
                                                     java.lang.String qnameLocalName)
        Description copied from class: AbstractLockDAOImpl
        Override to get the unique, lock resource entity if one exists.
        Specified by:
        getLockResource in class AbstractLockDAOImpl
        Parameters:
        qnameNamespaceId - the namespace entity ID
        qnameLocalName - the lock localname
        Returns:
        Returns the lock resource entity, or null if it doesn't exist
      • createLockResource

        protected LockResourceEntity createLockResource​(java.lang.Long qnameNamespaceId,
                                                        java.lang.String qnameLocalName)
        Description copied from class: AbstractLockDAOImpl
        Create a unique lock resource
        Specified by:
        createLockResource in class AbstractLockDAOImpl
        Parameters:
        qnameNamespaceId - the namespace entity ID
        qnameLocalName - the lock localname
        Returns:
        Returns the newly created lock resource entity
      • getLocksBySharedResourceIds

        protected java.util.List<LockEntity> getLocksBySharedResourceIds​(java.util.List<java.lang.Long> sharedLockResourceIds)
        Description copied from class: AbstractLockDAOImpl
        Get any existing lock data for the shared resources. The locks returned are not filtered and may be expired.
        Specified by:
        getLocksBySharedResourceIds in class AbstractLockDAOImpl
        Parameters:
        sharedLockResourceIds - a list of shared resource IDs for which to retrieve the current locks
        Returns:
        Returns a list of locks (expired or not) for the given lock resources
      • getLock

        protected LockEntity getLock​(java.lang.Long id)
        Specified by:
        getLock in class AbstractLockDAOImpl
        Parameters:
        id - the lock instance ID
        Returns:
        Returns the lock, if it exists, otherwise null
      • getLock

        protected LockEntity getLock​(java.lang.Long sharedResourceId,
                                     java.lang.Long exclusiveResourceId)
        Specified by:
        getLock in class AbstractLockDAOImpl
        Parameters:
        sharedResourceId - the shared lock resource ID
        exclusiveResourceId - the exclusive lock resource ID
        Returns:
        Returns the lock, if it exists, otherwise null
      • createLock

        protected LockEntity createLock​(java.lang.Long sharedResourceId,
                                        java.lang.Long exclusiveResourceId,
                                        java.lang.String lockToken,
                                        long timeToLive)
        Description copied from class: AbstractLockDAOImpl
        Create a new lock.
        Specified by:
        createLock in class AbstractLockDAOImpl
        Parameters:
        sharedResourceId - the specific resource to lock
        exclusiveResourceId - the exclusive lock that is being sought
        lockToken - the lock token to assign
        timeToLive - the time, in milliseconds, for the lock to remain valid
        Returns:
        Returns the new lock
      • updateLock

        protected LockEntity updateLock​(LockEntity lockEntity,
                                        java.lang.String lockToken,
                                        long timeToLive)
        Description copied from class: AbstractLockDAOImpl
        Update an existing lock
        Specified by:
        updateLock in class AbstractLockDAOImpl
        Parameters:
        lockEntity - the specific lock to update
        lockToken - the new lock token
        timeToLive - the new lock time, in milliseconds, for the lock to remain valid
        Returns:
        Returns the updated lock
      • updateLocks

        protected int updateLocks​(java.lang.Long exclusiveLockResourceId,
                                  java.lang.String oldLockToken,
                                  java.lang.String newLockToken,
                                  long timeToLive)
        Specified by:
        updateLocks in class AbstractLockDAOImpl
        Parameters:
        exclusiveLockResourceId - the exclusive resource ID being locks
        oldLockToken - the lock token to change from
        newLockToken - the new lock token
        timeToLive - the new time to live (in milliseconds)
        Returns:
        the number of rows updated