Interface ClusterAvailability

All Known Implementing Classes:
HealthMonitor
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 ClusterAvailability
Tells the router whether a cluster is currently worth sending traffic to.

Read selection needs this answer on every operation, so it has to be a cheap in-memory lookup - not a ping. This interface is that lookup, and it keeps routing independent of how availability is decided:

  • Phase 3 uses alwaysAvailable(), so balancing spreads over every registered cluster;
  • Phase 5 supplies the health monitor's windowed state, and read selection starts skipping unhealthy clusters with no change to the selectors themselves.

Implementations must be non-blocking and safe for concurrent use.

  • Method Summary

    Modifier and Type
    Method
    Description
    Treats every cluster as available - the Phase 3 default, before health monitoring exists.
    boolean
    isAvailable(String clusterName)
    Whether the named cluster should receive traffic right now.
  • Method Details

    • isAvailable

      boolean isAvailable(String clusterName)
      Whether the named cluster should receive traffic right now.
    • alwaysAvailable

      static ClusterAvailability alwaysAvailable()
      Treats every cluster as available - the Phase 3 default, before health monitoring exists.