Class AS4DuplicateManagerInMemory

java.lang.Object
com.helger.phase4.duplicate.AS4DuplicateManagerInMemory
All Implemented Interfaces:
IAS4DuplicateManager

@ThreadSafe public class AS4DuplicateManagerInMemory extends Object implements IAS4DuplicateManager
This is the duplicate checker for avoiding duplicate messages.
Author:
Philip Helger
  • Constructor Details

    • AS4DuplicateManagerInMemory

      public AS4DuplicateManagerInMemory()
  • Method Details

    • registerAndCheck

      public @NonNull com.helger.base.state.EContinue registerAndCheck(@Nullable String sMessageID, @Nullable String sProfileID, @Nullable String sPModeID)
      Description copied from interface: IAS4DuplicateManager
      Check if the passed message ID was already handled.
      Specified by:
      registerAndCheck in interface IAS4DuplicateManager
      Parameters:
      sMessageID - Message ID to check. May be null.
      sProfileID - Active AS4 profile ID. May be used to define the PMode further. May be null.
      sPModeID - Active AS4 PMode ID. May be null.
      Returns:
      EContinue.CONTINUE to continue processing a message, because it is no duplicate. EContinue.BREAK if it was determined as a duplicate.
    • clearCache

      public @NonNull com.helger.base.state.EChange clearCache()
      Description copied from interface: IAS4DuplicateManager
      Remove all entries in the cache.
      Specified by:
      clearCache in interface IAS4DuplicateManager
      Returns:
      EChange
    • evictAllItemsBefore

      @ReturnsMutableCopy public @NonNull com.helger.collection.commons.ICommonsList<String> evictAllItemsBefore(@NonNull OffsetDateTime aRefDT)
      Description copied from interface: IAS4DuplicateManager
      Delete all duplicate items that were created before the provided time.
      Specified by:
      evictAllItemsBefore in interface IAS4DuplicateManager
      Parameters:
      aRefDT - The reference date time to compare to. May not be null.
      Returns:
      A non-null list of all evicted message IDs.
    • isEmpty

      public boolean isEmpty()
      Specified by:
      isEmpty in interface IAS4DuplicateManager
      Returns:
      true if there are no entries contained, false otherwise.
    • size

      @Nonnegative public int size()
      Specified by:
      size in interface IAS4DuplicateManager
      Returns:
      The number contained entries. Always ≥ 0.
    • findFirst

      public @Nullable IAS4DuplicateItem findFirst(@NonNull Predicate<? super IAS4DuplicateItem> aFilter)
    • getItemOfMessageID

      public @Nullable IAS4DuplicateItem getItemOfMessageID(@Nullable String sMessageID)
      Description copied from interface: IAS4DuplicateManager
      Find the first item with the provided message ID.
      Specified by:
      getItemOfMessageID in interface IAS4DuplicateManager
      Parameters:
      sMessageID - The message ID to be searched. May be null.
      Returns:
      null if no matching entry is contained.
    • getAll

      @ReturnsMutableCopy public @NonNull com.helger.collection.commons.ICommonsList<IAS4DuplicateItem> getAll()
      Specified by:
      getAll in interface IAS4DuplicateManager
      Returns:
      All entries contained in the list.
    • toString

      public String toString()
      Overrides:
      toString in class Object