Package nxt.blockchain.atomictxs
Class AtomicChainsSet<T extends Transaction>
java.lang.Object
nxt.blockchain.atomictxs.AtomicChainsSet<T>
Set of transactions that tracks the atomic chains formed by the transactions in the set.
The priority order of the chains in the set is according to a comparator
provided in the constructor of this class. The highest priority ones are in
the beginning of the set, the lowest priority ones are in the end and can be
removed with removeLastChain()
getAllChains(). Users of this method should synchronize by locking
the AtomicChainsSet instance-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionAtomicChainsSet(Comparator<AtomicChain<T>> comparator) Construct a new set of atomic chains -
Method Summary
Modifier and TypeMethodDescriptionbooleanvoidclear()Returns an unmodifiable collection containing all chains in the set.List<AtomicChain<T>>getTransaction(Long id) booleanhasTransaction(Long id) booleanint
-
Field Details
-
CHAIN_ALREADY_EXISTS_MESSAGE
- See Also:
-
-
Constructor Details
-
AtomicChainsSet
Construct a new set of atomic chains- Parameters:
comparator-Order of the chains, the less significant ones being stored last.
If null, the natural ordering of the
This comparator must be consistent with equalsAtomicChains is used.
-
-
Method Details
-
add
-
remove
-
peekLastChain
-
removeLastChain
-
getTransaction
-
hasTransaction
-
transactionsCount
public int transactionsCount() -
clear
public void clear() -
getCompleteChains
-
getAllChains
Returns an unmodifiable collection containing all chains in the set. Note that concurrent modifications to the set may lead to concurrency issues with the returned collection. Ensure the set instance is locked during the usage of the returned collection.- Returns:
- an unmodifiable collection of chains
-
toTransactionsList
-