pip_services3_components.lock.NullLock module

class pip_services3_components.lock.NullLock.NullLock

Bases: pip_services3_components.lock.ILock.ILock

Dummy lock implementation that doesn’t do anything.

It can be used in testing or in situations when lock is required but shall be disabled.

acquire_lock(correlation_id: Optional[str], key: str, ttl: int, timeout: int)

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

  • ttl – a lock timeout (time to live) in milliseconds.

  • timeout – lock timeout

Returns

lock result

release_lock(correlation_id: Optional[str], key: str)
Parameters
  • correlation_id – (optional) transaction id to trace execution through call chain.

  • key – a unique lock key to acquire.

Returns

lock result

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