Module: ZK::Locker

Defined in:
lib/zk/locker.rb

Overview

Implements locking primitives described here

There are both shared and exclusive lock implementations.

NOTE: These lock instances are not safe for use across threads. If you want to use the same Locker instance between threads, it is your responsibility to synchronize operations.

Defined Under Namespace

Classes: ExclusiveLocker, LockerBase, NoWriteLockFoundException, SharedLocker, WeAreTheLowestLockNumberException

Constant Summary collapse

SHARED_LOCK_PREFIX =
'sh'.freeze
EXCLUSIVE_LOCK_PREFIX =
'ex'.freeze

Class Method Summary collapse

Class Method Details

.exclusive_locker(zk, name) ⇒ Object



18
19
20
# File 'lib/zk/locker.rb', line 18

def self.exclusive_locker(zk, name)
  ExclusiveLocker.new(zk, name)
end

.shared_locker(zk, name) ⇒ Object



14
15
16
# File 'lib/zk/locker.rb', line 14

def self.shared_locker(zk, name)
  SharedLocker.new(zk, name)
end