Merge branch 'master' of github.com:redisson/redisson

pull/1857/head
Nikita Koksharov 6 years ago
commit b289817a4c

@ -453,7 +453,12 @@ public class RedissonLock extends RedissonExpirable implements RLock {
@Override
public boolean isHeldByCurrentThread() {
RFuture<Boolean> future = commandExecutor.writeAsync(getName(), LongCodec.INSTANCE, RedisCommands.HEXISTS, getName(), getLockName(Thread.currentThread().getId()));
return isHeldByThread(Thread.currentThread().getId());
}
@Override
public boolean isHeldByThread(long threadId) {
final RFuture<Boolean> future = commandExecutor.writeAsync(getName(), LongCodec.INSTANCE, RedisCommands.HEXISTS, getName(), getLockName(threadId));
return get(future);
}

@ -98,6 +98,15 @@ public interface RLock extends Lock, RExpirable, RLockAsync {
*/
boolean isLocked();
/**
* Checks if this lock is held by the current thread
*
* @param threadId Thread ID of locking thread
* @return <code>true</code> if held by given thread
* otherwise <code>false</code>
*/
boolean isHeldByThread(long threadId);
/**
* Checks if this lock is held by the current thread
*

Loading…
Cancel
Save