Package com.atlassian.confluence.setup
Class SetupLocks
java.lang.Object
com.atlassian.confluence.setup.SetupLocks
Provide locks for actions so that they don't get run multiple times at once.
Be aware that this class will be instantiated in the setup context, and in the application context, and that locks
will not persist between contexts. If you wish to lock between contexts you'll need to use a different mechanism.
- Since:
- 5.10
-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
compareAndSet
(SetupLocks.Lock lock, boolean expect, boolean update) Atomically sets the value to the given updated value if the current value==
the expected value.void
set
(SetupLocks.Lock lock, boolean newValue) Unconditionally sets to the given value.
-
Constructor Details
-
SetupLocks
public SetupLocks()
-
-
Method Details
-
compareAndSet
Atomically sets the value to the given updated value if the current value==
the expected value.- Parameters:
lock
- the enum representing the lock to compare and setexpect
- the expected valueupdate
- the new value- Returns:
true
if successful. False return indicates that the actual value was not equal to the expected value.
-
set
Unconditionally sets to the given value.- Parameters:
lock
- the enum representing the lock to setnewValue
- the new value
-