Class InmemDLock

    • Constructor Detail

      • InmemDLock

        public InmemDLock​(String name)
    • Method Detail

      • lock

        public LockResult lock​(int waitWeight,
                               String clientId,
                               long lockDurationMs)
        Acquire the lock for clientId for a duration of lockDurationMs.

        Reentrant: lock can be acquired multiple times by the same clientId. Lock's expiry will be extended accordingly.

        Parameters:
        waitWeight - "fairness": clientId with higher waitWeight value might have higher chance to acquire the lock, negative value means "no fairness"
        clientId - within a namespace, only one client is allowed to hold the lock as a given time
        Returns:
        LockResult.SUCCESSFUL if successful, LockResult.HOLD_BY_ANOTHER_CLIENT if lock is currently hold by another client