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
  • Constructor Details

    • SetupLocks

      public SetupLocks()
  • Method Details

    • 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 set
      expect - the expected value
      update - 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 set
      newValue - the new value