pip_services3_components.lock.Lock module
-
class
pip_services3_components.lock.Lock.
Lock
Bases:
pip_services3_components.lock.ILock.ILock
,pip_services3_commons.config.IReconfigurable.IReconfigurable
-
acquire_lock
(correlation_id: Optional[str], key: str, ttl: int, timeout: int) Makes multiple attempts to acquire a lock by its key within give time interval.
- Parameters
correlation_id – (optional) transaction id to trace execution through call chain.
key – a unique lock key to acquire.
ttl – a lock timeout (time to live) in milliseconds.
timeout – a lock acquisition timeout.
-
configure
(config: pip_services3_commons.config.ConfigParams.ConfigParams) Configures component by passing configuration parameters.
- Parameters
config – configuration parameters to be set.
-
abstract
release_lock
(correlation_id: Optional[str], key: str) Releases prevously acquired lock by its key.
- Parameters
correlation_id – (optional) transaction id to trace execution through call chain.
key – a unique lock key to release.
- Returns
receive null for success.
-
abstract
try_acquire_lock
(correlation_id: Optional[str], key: str, ttl: int) → bool Makes a single attempt to acquire a lock by its key. It returns immediately a positive or negative result.
- Parameters
correlation_id – (optional) transaction id to trace execution through call chain.
key – a unique lock key to acquire.
ttl – a lock timeout (time to live) in milliseconds.
- Returns
lock result
-