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.
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 Summary
Modifier and TypeMethodDescriptionstatic MemberSelectoralive()Select members that are currently alive.static MemberSelectorall()Select every candidate member.default MemberSelectorand(MemberSelector other) Combine this selector with another selector using logical AND.static MemberSelectorSelect members whose attribute exactly matches the expected value.static MemberSelectorhasAttribute(String name) Select members that have the named attribute, regardless of value.default MemberSelectornegate()Invert this selector.default MemberSelectoror(MemberSelector other) Combine this selector with another selector using logical OR.booleanDecide whether the given member should receive the executor task.
-
Method Details
-
select
Decide whether the given member should receive the executor task.- Parameters:
member- the candidate cluster member- Returns:
- true when the member is selected
-
all
Select every candidate member.- Returns:
- a selector that accepts all non-null members
-
alive
Select members that are currently alive.- Returns:
- a selector that accepts alive members only
-
attribute
Select members whose attribute exactly matches the expected value.- Parameters:
name- the member attribute name, such as rack, zone, node, or regionvalue- the expected member attribute value- Returns:
- an attribute-matching selector
-
hasAttribute
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
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
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
Invert this selector.- Returns:
- a selector with the opposite decision
-