@ThreadSafe public final class ScreenLock extends Object
| Modifier and Type | Method and Description |
|---|---|
void |
acquire(Object newOwner)
Acquires this lock.
|
boolean |
acquired()
Indicates whether this lock is already acquired.
|
boolean |
acquiredBy(Object possibleOwner)
Indicates whether this lock was acquired by the given object.
|
Object |
getOwner() |
static ScreenLock |
instance() |
void |
release(Object currentOwner)
Releases this lock.
|
public void acquire(@Nonnull Object newOwner)
newOwner - the new owner of the lock.public void release(@Nonnull Object currentOwner)
currentOwner - the current owner of the lock.ScreenLockException - if the lock has not been previously acquired.ScreenLockException - if the given owner is not the same as the current owner of the lock.public boolean acquiredBy(@Nonnull Object possibleOwner)
possibleOwner - the given object, which could be owning the lock.true if the given object is owning the lock; false otherwise.public boolean acquired()
true if the lock is already acquired; false otherwise.acquiredBy(Object)@Nullable public Object getOwner()
null if no object is owning the lock. If
acquired() is true calling acquiredBy(Object) with getOwner()
returns true.@Nonnull public static ScreenLock instance()
Copyright © 2014 AssertJ. All rights reserved.