public class ReadOnlyWriteLock extends Object implements WriteLock
Constructor and Description |
---|
ReadOnlyWriteLock() |
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.
|
void |
unlock()
May not unlock.
|
public void lock()
WriteLock
This is not re-entrant i.e. if you lock and try and lock again it will timeout and recover
public void unlock()
WriteLock
public void close()
public boolean forceUnlockIfProcessIsDead()
WriteLock
This will leave the lock in following states:
forceUnlockIfProcessIsDead
in interface WriteLock
true
lock was left in an unlocked state, false
if the lock was left in a locked state.public boolean isLockedByCurrentProcess(LongConsumer notCurrentProcessConsumer)
isLockedByCurrentProcess
in interface WriteLock
Copyright © 2023. All rights reserved.