Package org.fest.swing.lock
Class ScreenLock
java.lang.Object
org.fest.swing.lock.ScreenLock
Understands a lock that each GUI test should acquire before being executed, to guarantee sequential execution of
GUI tests and to prevent GUI tests from blocking each other.
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
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.private boolean
alreadyAcquiredBy
(Object possibleOwner) static ScreenLock
instance()
Returns the singleton instance of this class.void
Releases this lock.
-
Field Details
-
lock
-
released
-
owner
-
acquired
private boolean acquired
-
-
Constructor Details
-
ScreenLock
ScreenLock()
-
-
Method Details
-
acquire
Acquires this lock. If this lock was already acquired by another object, this method will block until the lock is released.- Parameters:
newOwner
- the new owner of the lock.
-
release
Releases this lock.- Parameters:
currentOwner
- the current owner of the lock.- Throws:
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.
-
acquiredBy
Indicates whether this lock was acquired by the given object.- Parameters:
possibleOwner
- the given object, which could be owning the lock.- Returns:
true
if the given object is owning the lock;false
otherwise.
-
alreadyAcquiredBy
-
acquired
public boolean acquired()Indicates whether this lock is already acquired.- Returns:
true
if the lock is already acquired;false
otherwise.- Since:
- 1.2
- See Also:
-
instance
Returns the singleton instance of this class.- Returns:
- the singleton instance of this class.
-