Class ModificationList

java.lang.Object
org.infinispan.transaction.impl.ModificationList

public final class ModificationList extends Object
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 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 the WriteCommand to this list.
      Parameters:
      command - The WriteCommand instance to append.
      Throws:
      IllegalStateException - If this list is frozen.
      See Also:
    • freeze

      public void freeze()
      Freezes this list.

      After invoked, no more WriteCommand can be appended to this list. append(WriteCommand) will throw a IllegalStateException.

    • getModifications

      public List<org.infinispan.commands.write.WriteCommand> getModifications()
      Returns a snapshot of this list.

      This snapshot does not contain WriteCommand with flag Flag.CACHE_MODE_LOCAL and it cannot be modified.

      Returns:
      A snapshot of this list.
    • hasNonLocalModifications

      public boolean hasNonLocalModifications()
      Returns:
      true if it contains one or more WriteCommand without Flag.CACHE_MODE_LOCAL.
    • getAllModifications

      public List<org.infinispan.commands.write.WriteCommand> getAllModifications()
      Returns:
      A snapshot of this list with all WriteCommand. The List cannot be modified.
      See Also:
    • size

      public int size()
      Returns:
      The number of WriteCommand stored this list.
    • isEmpty

      public boolean isEmpty()
      Returns:
      true if this list is empty.
    • toString

      public String toString()
      Overrides:
      toString in class Object