Module: ZK::Locker
- Defined in:
- lib/z_k/locker.rb
Overview
Implements locking primitives described here
There are both shared and exclusive lock implementations.
NOTE: These locks are not safe for use across threads. If you want to use the same Locker class 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
19 20 21 |
# File 'lib/z_k/locker.rb', line 19 def self.exclusive_locker(zk, name) ExclusiveLocker.new(zk, name) end |
.shared_locker(zk, name) ⇒ Object
15 16 17 |
# File 'lib/z_k/locker.rb', line 15 def self.shared_locker(zk, name) SharedLocker.new(zk, name) end |