0

As title, may I know do the waitForUnlock method exist Redisson? I search though internet and check the method one by one seem no method suit my use case. Below is the code how I make it. Do we have better option or I miss out something? Thanks.

public void methodA() {
    RLock lock = redisson.getLock("myLock");
    lock.lock(10, TimeUnit.SECONDS);
    // action
    lock.unlock();
}

public void methodB() {
    waitForUnlock();
}

public void waitForUnlock() {
    RLock lock = redisson.getLock("myLock");
    while(lock.isLock()) {}  // wait for unlock without create lock
    // action;
}

karfai
  • 816
  • 1
  • 10
  • 21

0 Answers0