Package org.infinispan.transaction.impl
Class ModificationList
java.lang.Object
org.infinispan.transaction.impl.ModificationList
A list of
WriteCommand for a transaction
WriteCommand can only be appended and the methods getAllModifications() and getModifications() return a snapshot of the current list. WriteCommand appended after those methods are
invoked, are not visible.
- Since:
- 14.0
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidappend(org.infinispan.commands.write.WriteCommand command) Appends theWriteCommandto this list.voidfreeze()Freezes this list.static ModificationListfromCollection(Collection<org.infinispan.commands.write.WriteCommand> mods) List<org.infinispan.commands.write.WriteCommand>List<org.infinispan.commands.write.WriteCommand>Returns a snapshot of this list.booleanbooleanisEmpty()intsize()toString()
-
Constructor Details
-
ModificationList
public ModificationList() -
ModificationList
public ModificationList(int capacity)
-
-
Method Details
-
fromCollection
public static ModificationList fromCollection(Collection<org.infinispan.commands.write.WriteCommand> mods) -
append
public void append(org.infinispan.commands.write.WriteCommand command) Appends theWriteCommandto this list.- Parameters:
command- TheWriteCommandinstance to append.- Throws:
IllegalStateException- If this list is frozen.- See Also:
-
freeze
public void freeze()Freezes this list.After invoked, no more
WriteCommandcan be appended to this list.append(WriteCommand)will throw aIllegalStateException. -
getModifications
Returns a snapshot of this list.This snapshot does not contain
WriteCommandwith flagFlag.CACHE_MODE_LOCALand it cannot be modified.- Returns:
- A snapshot of this list.
-
hasNonLocalModifications
public boolean hasNonLocalModifications()- Returns:
trueif it contains one or moreWriteCommandwithoutFlag.CACHE_MODE_LOCAL.
-
getAllModifications
- Returns:
- A snapshot of this list with all
WriteCommand. TheListcannot be modified. - See Also:
-
size
public int size()- Returns:
- The number of
WriteCommandstored this list.
-
isEmpty
public boolean isEmpty()- Returns:
trueif this list is empty.
-
toString
-