Interface MemberSelector

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 MemberSelector
Public SPI for selecting executor target members from a cluster membership snapshot.

Selectors are intentionally small and synchronous: implementations should only inspect the supplied NodeInfo and return whether the submitted task may target that member.

  • Method Details

    • select

      boolean select(NodeInfo member)
      Decide whether the given member should receive the executor task.
      Parameters:
      member - the candidate cluster member
      Returns:
      true when the member is selected
    • all

      static MemberSelector all()
      Select every candidate member.
      Returns:
      a selector that accepts all non-null members
    • alive

      static MemberSelector alive()
      Select members that are currently alive.
      Returns:
      a selector that accepts alive members only
    • attribute

      static MemberSelector attribute(String name, String value)
      Select members whose attribute exactly matches the expected value.
      Parameters:
      name - the member attribute name, such as rack, zone, node, or region
      value - the expected member attribute value
      Returns:
      an attribute-matching selector
    • hasAttribute

      static MemberSelector hasAttribute(String name)
      Select members that have the named attribute, regardless of value.
      Parameters:
      name - the member attribute name
      Returns:
      a selector that accepts members with the attribute present
    • and

      default MemberSelector and(MemberSelector other)
      Combine this selector with another selector using logical AND.
      Parameters:
      other - the selector that must also match
      Returns:
      a selector that matches only when both selectors match
    • or

      default MemberSelector or(MemberSelector other)
      Combine this selector with another selector using logical OR.
      Parameters:
      other - the selector that may also match
      Returns:
      a selector that matches when either selector matches
    • negate

      default MemberSelector negate()
      Invert this selector.
      Returns:
      a selector with the opposite decision