Class MemStatementList

java.lang.Object
org.eclipse.rdf4j.sail.memory.model.MemStatementList

public class MemStatementList extends Object
A dedicated data structure for storing MemStatement objects, offering operations optimized for their use in the memory Sail.
  • Field Details

    • EMPTY_ARRAY

      private static final MemStatement[] EMPTY_ARRAY
    • statements

      private volatile MemStatement[] statements
    • STATEMENTS

      private static final VarHandle STATEMENTS
    • STATEMENTS_ARRAY

      static final VarHandle STATEMENTS_ARRAY
    • size

      private volatile int size
    • SIZE

      private static final VarHandle SIZE
    • previouslyInsertedIndex

      private volatile int previouslyInsertedIndex
    • PREVIOUSLY_INSERTED_INDEX

      private static final VarHandle PREVIOUSLY_INSERTED_INDEX
    • guaranteedLastIndexInUse

      private volatile int guaranteedLastIndexInUse
    • GUARANTEED_LAST_INDEX_IN_USE

      private static final VarHandle GUARANTEED_LAST_INDEX_IN_USE
    • prioritiseCleanup

      private volatile boolean prioritiseCleanup
    • PRIORITISE_CLEANUP

      private static final VarHandle PRIORITISE_CLEANUP
    • prioritisedThread

      private final AtomicReference<Thread> prioritisedThread
  • Constructor Details

    • MemStatementList

      public MemStatementList()
    • MemStatementList

      public MemStatementList(int capacity)
  • Method Details

    • size

      public int size()
    • isEmpty

      public boolean isEmpty()
    • add

      public void add(MemStatement st) throws InterruptedException
      Throws:
      InterruptedException
    • updateGuaranteedLastIndexInUse

      private void updateGuaranteedLastIndexInUse(int newValue)
    • optimisticRemove

      public boolean optimisticRemove(MemStatement st) throws InterruptedException
      Throws:
      InterruptedException
    • optimisticRemove

      public boolean optimisticRemove(MemStatement st, int index) throws InterruptedException
      Throws:
      InterruptedException
    • optimisticInnerRemove

      private boolean optimisticInnerRemove(MemStatement toRemove, MemStatement[] statements, int i)
    • clear

      public void clear()
    • cleanSnapshots

      public void cleanSnapshots(int currentSnapshot) throws InterruptedException
      Throws:
      InterruptedException
    • getExact

      public MemStatement getExact(MemResource subject, MemIRI predicate, MemValue object, MemResource context, int snapshot) throws InterruptedException
      Iterates through this list and returns the statement that exactly matches the provided arguments. The subject, predicate and object should not be null. If the context is null it will match statements with null as their context.
      Parameters:
      subject -
      predicate -
      object -
      context -
      snapshot -
      Returns:
      Throws:
      InterruptedException
    • getStatements

      public MemStatement[] getStatements() throws InterruptedException
      An internal method to retrieve the inner array that stores the statements. Useful to reduce the number of volatile reads.
      Returns:
      the underlying array og MemStatements
      Throws:
      InterruptedException
    • getStatementsWithoutInterrupt

      private MemStatement[] getStatementsWithoutInterrupt()
    • getGuaranteedLastIndexInUse

      public int getGuaranteedLastIndexInUse()
    • setPrioritiseCleanup

      public void setPrioritiseCleanup(boolean prioritiseCleanup)
    • verifySizeForTesting

      boolean verifySizeForTesting()
    • getRealSizeForTesting

      int getRealSizeForTesting()