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()
WriteLockThis is not re-entrant i.e. if you lock and try and lock again it will timeout and recover
public void unlock()
WriteLockpublic void close()
public boolean forceUnlockIfProcessIsDead()
WriteLockThis will leave the lock in following states:
forceUnlockIfProcessIsDead in interface WriteLocktrue 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 WriteLockCopyright © 2024. All rights reserved.