com.atlassian.beehive
Interface ClusterLockService

All Known Implementing Classes:
DatabaseClusterLockService, HazelcastClusterLockService, SimpleClusterLockService

@PublicApi
public interface ClusterLockService

Provides methods for running code under a cluster-wide lock.

For safety reasons, an acquired lock will never time-out. However if the node that holds the lock is shutdown or is unable to reach the DB for an extended period then the lock is considered to no longer be valid and can be acquired by another node.

The Locks returned by this service are re-entrant.

A simple implementation of this Service can be provided by single-node apps in order to satisfy cross-product libraries that need it.

Lock names can be up to 255 characters. Obviously they should be namespaced adequately to avoid conflicts with other plugins - the reverse DNS name convention is recommended. Some implementations will store the lock name in the underlying database, and so the name may be treated as case-sensitive in some environments, and case-insensitive in other environments. To avoid unforeseen compatibility issues, consumers are recommended to use names that consist of "simple" ASCII characters (eg alphanumeric, hyphen and underscore).

Application developers should consider using one of the implementations provided by beehive-core or beehive-hazelcast instead of creating an implementation that is specific to the application.


Method Summary
 ClusterLock getLockForName(String lockName)
          Returns the cluster-wide lock for the given name.
 

Method Detail

getLockForName

ClusterLock getLockForName(@Nonnull
                           String lockName)
Returns the cluster-wide lock for the given name.

Parameters:
lockName - the globally unique lock identifier
Returns:
the cluster-wide lock for the given name.


Copyright © 2014 Atlassian. All Rights Reserved.