Class BambooClusterLockRawJdbcDao

    • Constructor Detail

      • BambooClusterLockRawJdbcDao

        public BambooClusterLockRawJdbcDao​(@NotNull
                                           @NotNull ClusterNodeHeartbeatDao clusterNodeHeartbeatDao)
    • Method Detail

      • getAllHeldClusterLocks

        @NotNull
        public @NotNull List<com.atlassian.beehive.core.ClusterLockStatus> getAllHeldClusterLocks()
        Specified by:
        getAllHeldClusterLocks in interface com.atlassian.beehive.db.spi.ClusterLockDao
      • getClusterLockStatusByName

        @Nullable
        public @Nullable com.atlassian.beehive.core.ClusterLockStatus getClusterLockStatusByName​(@NotNull
                                                                                                 @NotNull String lockName)
        Description copied from interface: BambooClusterLockDao
        Returns the cluster lock details for the given name and or null if no such lock has ever been created.
        Specified by:
        getClusterLockStatusByName in interface BambooClusterLockDao
        Specified by:
        getClusterLockStatusByName in interface com.atlassian.beehive.db.spi.ClusterLockDao
        Parameters:
        lockName - the globally unique id of the lock
        Returns:
        the cluster lock details for the given name, or null if no such lock has ever been created.
      • getClusterMultiLockStatusByNamePrefix

        @NotNull
        public @NotNull Set<com.atlassian.beehive.core.ClusterLockStatus> getClusterMultiLockStatusByNamePrefix​(@NotNull
                                                                                                                @NotNull String lockNamePrefix)
        Description copied from interface: BambooClusterLockDao
        Returns the cluster lock details based on a name prefix, or empty if no such lock exists. It allows multiple nodes to have the same lock, differing only by a suffix (for instance, in case of READ lock).
        Specified by:
        getClusterMultiLockStatusByNamePrefix in interface BambooClusterLockDao
        Parameters:
        lockNamePrefix - the prefix that will be used to find the locks
        Returns:
        the cluster READ lock details for the given prefix, or empty if none.
      • deleteExpiredLocksByPrefix

        public void deleteExpiredLocksByPrefix​(@NotNull
                                               @NotNull String lockNamePrefix,
                                               long lockTimeoutSeconds)
        Description copied from interface: BambooClusterLockDao
        Deletes the locks identified by a given prefix that are expired based on a given timeout in seconds.
        Specified by:
        deleteExpiredLocksByPrefix in interface BambooClusterLockDao
        Parameters:
        lockNamePrefix - the prefix that will be used to find the locks
        lockTimeoutSeconds - time (in seconds) after which the lock can be taken over
      • tryAcquireLock

        @Deprecated(since="Since 9.4 use tryUpdateAcquireNodeScopedLock instead")
        public boolean tryAcquireLock​(@NotNull
                                      @NotNull String lockName)
        Deprecated.
        Specified by:
        tryAcquireLock in interface com.atlassian.beehive.db.spi.ClusterLockDao
      • tryUpdateAcquireNodeScopedLock

        public boolean tryUpdateAcquireNodeScopedLock​(@NotNull
                                                      @NotNull String lockName,
                                                      long lockTimeoutSeconds)
        Description copied from interface: BambooClusterLockDao
        Try to acquire an existing lock for the current node. This method will succeed and will update the lock timestamp both when the lock has been just acquired by the node and when the lock is already owned by the current node.

        See also ClusterLockDao.tryAcquireLock(String)

        Specified by:
        tryUpdateAcquireNodeScopedLock in interface BambooClusterLockDao
        Parameters:
        lockName - name of the lock to acquire
        lockTimeoutSeconds - time (in seconds) after which the lock can be taken over
        Returns:
        true if the lock has been acquired/updated successfully, false otherwise
      • tryUpdateAcquireNodeScopedLock

        public boolean tryUpdateAcquireNodeScopedLock​(@NotNull
                                                      @NotNull String lockName,
                                                      @NotNull
                                                      @NotNull String nodeId,
                                                      long lockTimeoutSeconds)
        Description copied from interface: BambooClusterLockDao
        Try to acquire an existing lock for the given node. This method will succeed and will update the lock timestamp both when the lock has been just acquired by the node and when the lock is already owned by the given node.

        See also ClusterLockDao.tryAcquireLock(String)

        Specified by:
        tryUpdateAcquireNodeScopedLock in interface BambooClusterLockDao
        Parameters:
        lockName - name of the lock to acquire
        nodeId - this node id
        lockTimeoutSeconds - time (in seconds) after which the lock can be taken over
        Returns:
        true if the lock has been acquired/updated successfully, false otherwise
      • insertEmptyClusterLock

        public void insertEmptyClusterLock​(@NotNull
                                           @NotNull String lockName)
        Specified by:
        insertEmptyClusterLock in interface com.atlassian.beehive.db.spi.ClusterLockDao
      • unlock

        public void unlock​(@NotNull
                           @NotNull String lockName)
        Specified by:
        unlock in interface com.atlassian.beehive.db.spi.ClusterLockDao
      • renewLease

        public void renewLease​(@NotNull
                               @NotNull String lockName)
        Specified by:
        renewLease in interface com.atlassian.beehive.db.spi.ClusterLockDao
      • renewLease

        public void renewLease​(@NotNull
                               @NotNull String lockName,
                               @NotNull
                               @NotNull String nodeId)
      • releaseLocksHeldByNode

        public void releaseLocksHeldByNode()
        Specified by:
        releaseLocksHeldByNode in interface com.atlassian.beehive.db.spi.ClusterLockDao
      • deleteLocksHeldByNode

        public void deleteLocksHeldByNode​(String nodeId)