Class MemStatementList
java.lang.Object
org.eclipse.rdf4j.sail.memory.model.MemStatementList
A dedicated data structure for storing MemStatement objects, offering operations optimized for their use in the
memory Sail.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final MemStatement[]
private static final VarHandle
private int
private static final VarHandle
private int
private static final VarHandle
private boolean
private final AtomicReference
<Thread> private int
private static final VarHandle
private MemStatement[]
private static final VarHandle
(package private) static final VarHandle
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
add
(MemStatement st) void
cleanSnapshots
(int currentSnapshot) void
clear()
getExact
(MemResource subject, MemIRI predicate, MemValue object, MemResource context, int snapshot) Iterates through this list and returns the statement that exactly matches the provided arguments.int
(package private) int
An internal method to retrieve the inner array that stores the statements.private MemStatement[]
boolean
isEmpty()
private boolean
optimisticInnerRemove
(MemStatement toRemove, MemStatement[] statements, int i) boolean
boolean
optimisticRemove
(MemStatement st, int index) void
setPrioritiseCleanup
(boolean prioritiseCleanup) int
size()
private void
updateGuaranteedLastIndexInUse
(int newValue) (package private) boolean
-
Field Details
-
EMPTY_ARRAY
-
statements
-
STATEMENTS
-
STATEMENTS_ARRAY
-
size
private volatile int size -
SIZE
-
previouslyInsertedIndex
private volatile int previouslyInsertedIndex -
PREVIOUSLY_INSERTED_INDEX
-
guaranteedLastIndexInUse
private volatile int guaranteedLastIndexInUse -
GUARANTEED_LAST_INDEX_IN_USE
-
prioritiseCleanup
private volatile boolean prioritiseCleanup -
PRIORITISE_CLEANUP
-
prioritisedThread
-
-
Constructor Details
-
MemStatementList
public MemStatementList() -
MemStatementList
public MemStatementList(int capacity)
-
-
Method Details
-
size
public int size() -
isEmpty
public boolean isEmpty() -
add
- Throws:
InterruptedException
-
updateGuaranteedLastIndexInUse
private void updateGuaranteedLastIndexInUse(int newValue) -
optimisticRemove
- Throws:
InterruptedException
-
optimisticRemove
- Throws:
InterruptedException
-
optimisticInnerRemove
-
clear
public void clear() -
cleanSnapshots
- 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
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
-
getGuaranteedLastIndexInUse
public int getGuaranteedLastIndexInUse() -
setPrioritiseCleanup
public void setPrioritiseCleanup(boolean prioritiseCleanup) -
verifySizeForTesting
boolean verifySizeForTesting() -
getRealSizeForTesting
int getRealSizeForTesting()
-