Class LockList

java.lang.Object
org.basex.core.locks.LockList
All Implemented Interfaces:
Iterable<String>

public final class LockList extends Object implements Iterable<String>
List with strings that serve as lock keys.
Author:
BaseX Team 2005-21, BSD License, Christian Gruen
  • Constructor Details

    • LockList

      public LockList()
  • Method Details

    • add

      public LockList add(String lock)
      Adds a local lock if no global lock has been added.
      Parameters:
      lock - lock to be added
      Returns:
      self reference
    • local

      public boolean local()
      Indicates if local locks exist.
      Returns:
      result of check
    • addGlobal

      public void addGlobal()
      Sets a global lock. All existing and following local locks will be ignored.
    • reset

      public void reset()
      Resets the lock list.
    • global

      public boolean global()
      Indicates if a global lock exists.
      Returns:
      result of check
    • locking

      public boolean locking()
      Indicates if any lock exists.
      Returns:
      result of check
    • add

      public void add(LockList locks)
      Adds another lock list. A global lock will be adopted.
      Parameters:
      locks - lock list
    • remove

      public void remove(LockList locks)
      Removes all locks from the specified list.
      Parameters:
      locks - lock list
    • get

      public String get(int index)
      Returns the element at the specified position.
      Parameters:
      index - element index
      Returns:
      element
    • contains

      public boolean contains(String lock)
      Checks if the specified lock is found in the list.
      Parameters:
      lock - lock to be found
      Returns:
      result of check
    • size

      public int size()
      Returns the number of local locks.
      Returns:
      number of local locks
    • finish

      public void finish(String name)
      Finishes the lock list. Locks of type Locking.COLLECTION and Locking.CONTEXT will be replaced with the name of the current database, if it exists, or deleted otherwise. The resulting list will be sorted, and duplicates will be removed.
      Parameters:
      name - name of currently opened database
    • iterator

      public Iterator<String> iterator()
      Specified by:
      iterator in interface Iterable<String>
    • toString

      public String toString()
      Overrides:
      toString in class Object