Interface ClusterLockService

All Known Implementing Classes:
DatabaseClusterLockService, SimpleClusterLockService

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 not intended to be re-entrant. Some implementations may be accidentally re-entrant, but do not rely on this behaviour.

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).

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

Method Detail


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

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

Copyright © 2014 Atlassian. All Rights Reserved.