Interface DispatchPredicate

Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public interface DispatchPredicate
A predicate class used by ScheduledDataLoaderRegistry to decide whether to dispatch or not
  • Method Details

    • test

      boolean test(String dataLoaderKey, DataLoader<?,?> dataLoader)
      This predicate tests whether the data loader should be dispatched or not.
      Parameters:
      dataLoaderKey - the key of the data loader when registered
      dataLoader - the dataloader to dispatch
      Returns:
      true if the data loader SHOULD be dispatched
    • and

      default DispatchPredicate and(DispatchPredicate other)
      Returns a composed predicate that represents a short-circuiting logical AND of this predicate and another.
      Parameters:
      other - a predicate that will be logically-ANDed with this predicate
      Returns:
      a composed predicate that represents the short-circuiting logical AND of this predicate and the other predicate
    • negate

      default DispatchPredicate negate()
      Returns a predicate that represents the logical negation of this predicate.
      Returns:
      a predicate that represents the logical negation of this predicate
    • or

      Returns a composed predicate that represents a short-circuiting logical OR of this predicate and another.
      Parameters:
      other - a predicate that will be logically-ORed with this predicate
      Returns:
      a composed predicate that represents the short-circuiting logical OR of this predicate and the other predicate
    • dispatchIfLongerThan

      static DispatchPredicate dispatchIfLongerThan(Duration duration)
      This predicate will return true if the DataLoader has not be dispatched for at least the duration length of time.
      Parameters:
      duration - the length of time to check
      Returns:
      true if the data loader has not been dispatched in duration time
    • dispatchIfDepthGreaterThan

      static DispatchPredicate dispatchIfDepthGreaterThan(int depth)
      This predicate will return true if the DataLoader.dispatchDepth() is greater than the specified depth. This will act as minimum batch size. There must be more than `depth` items queued for the predicate to return true.
      Parameters:
      depth - the value to be greater than
      Returns:
      true if the DataLoader.dispatchDepth() is greater than the specified depth.