Search code examples
redisson

Redisson: Why reactive client doesn't have PermitExpirableSemaphore?


I am using redisson reactive Java client. In non reactive client one could get an expirable Semaphore as:-

RPermitExpirableSemaphore semaphore = redisson.getPermitExpirableSemaphore("mySemaphore");

But If I create a reactive client, I can only find redisson.getSemaphore("value") function. I need PermitExpirableSemaphore because:-

  1. I need a lock which could be released by different thread(so can't use RLock).
  2. I need a lease timeout to prevent deadlock in case the lock aquiring thread is killed or stuck.

Is there any way to achieve this behavior in Redisson Distributed Locking?

Edit1: I can set lease time global in Config as:- Config().setLockWatchdogTimeout(leaseTimeMs), but I really need different leasetime at different locks.

Edit2: Asked a question on Redisson github at https://github.com/redisson/redisson/issues/1391


Solution

  • As linked in the edit2, there was no way of doing this in Redisson. Nikita, who is lead developer of Redisson quickly introduced the requested feature, to be launched in 2.11.6.