How phonepe/dlm works
PhonePe DLM is a Java library for exclusive distributed locks, with Aerospike and HBase storage adapters. An application initializes the manager, creates a lock identity, attempts immediate or waiting acquisition, performs protected work after acquisition, and releases the lock; the configured TTL handles expiry. LockBase owns retry timing and delegates persistence to the selected store. README capabilities also include DC/XDC levels and custom lock timing. Backend wiring is configurable; the graph reflects documented usage and sampled calls, not unsampled internals.
Main entry points: LockBase.java Lock orchestration · DistributedLockManager.java Lock manager · AerospikeStore.java Aerospike store · HBaseStore.java HBase store
Components 11
Application API
- Lock manager
dlm-core/src/main/java/com/phonepe/dlm/DistributedLockManager.java - Lock identity
dlm-core/src/main/java/com/phonepe/dlm/lock/Lock.java
Lock coordination
- Lock orchestration
dlm-core/src/main/java/com/phonepe/dlm/lock/base/LockBase.java - Timing config
dlm-core/src/main/java/com/phonepe/dlm/lock/base/LockConfiguration.java - Wait timer
dlm-core/src/main/java/com/phonepe/dlm/utils/Timer.java - Lock levels
dlm-core/src/main/java/com/phonepe/dlm/lock/level/LockLevel.java
Storage backends
- Aerospike store
dlm-aerospike/src/main/java/com/phonepe/dlm/aerospike/storage/AerospikeStore.java - HBase store
dlm-hbase/src/main/java/com/phonepe/dlm/hbase/storage/HBaseStore.java
Other components
- Application
- Aerospike
- HBase
Connections 12
- Application → Lock manager: initializes and calls
- Lock manager → Lock identity: creates identity
- Lock manager → Lock orchestration: delegates lock operations
- Lock manager → Lock orchestration: initializes and closes store
- Lock orchestration → Timing config: reads timings
- Lock orchestration → Wait timer: checks wait timeout
- Lock orchestration → Aerospike store: writes and removes
- Lock orchestration → HBase store: writes and removes
- Aerospike store → Aerospike: persists lock records
- HBase store → HBase: creates table and persists
- Aerospike store → Lock levels: formats level keys
- HBase store → Lock levels: formats level keys