Package com.atlassian.confluence.setup
Class SetupLocks
- java.lang.Object
-
- com.atlassian.confluence.setup.SetupLocks
-
public class SetupLocks extends Object
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 Modifier and Type Class Description static class
SetupLocks.Lock
-
Constructor Summary
Constructors Constructor Description SetupLocks()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
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.
-
-
-
Method Detail
-
compareAndSet
public boolean compareAndSet(SetupLocks.Lock lock, boolean expect, boolean update)
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
public void set(SetupLocks.Lock lock, boolean newValue)
Unconditionally sets to the given value.- Parameters:
lock
- the enum representing the lock to setnewValue
- the new value
-
-