public interface WriteLock extends Closeable
Modifier and Type | Method and Description |
---|---|
void |
close() |
boolean |
forceUnlockIfProcessIsDead()
Forcibly unlocks only if the process that currently holds the lock is no-longer running.
|
boolean |
isLockedByCurrentProcess(LongConsumer notCurrentProcessConsumer) |
void |
lock()
Guaranteed to succeed in getting the lock (may involve timeout and recovery) or else throw.
|
default boolean |
locked() |
void |
unlock()
May not unlock.
|
static final WriteLock NO_OP
void lock()
This is not re-entrant i.e. if you lock and try and lock again it will timeout and recover
void unlock()
void close()
close
in interface AutoCloseable
close
in interface Closeable
default boolean locked()
boolean forceUnlockIfProcessIsDead()
This will leave the lock in following states:
true
lock was left in an unlocked state, false
if the lock was left in a locked state.boolean isLockedByCurrentProcess(LongConsumer notCurrentProcessConsumer)
Copyright © 2023. All rights reserved.