Interface RequestClassifier<R>

Type Parameters:
R - type of the request
All Known Implementing Classes:
HttpRequestClassifier

public interface RequestClassifier<R>
Assigns a cohort number to a request. There is 128 statically defined cohorts, where the minimum cohort number is 1 and maximum is 128, inclusive. All classifiers are inspected and the first one that returns true for appliesTo(Object) is taken.

An implementation must be a CDI bean, otherwise it is ignored. CDI typesafe resolution rules must be followed. That is, if multiple implementations are provided with different Priority values, only the implementations with the highest priority are retained.

  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final int
     
    static final int
     
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    appliesTo(Object request)
    Returns whether this request classifier applies to given request.
    int
    cohort(R request)
    Returns the cohort to which the given request belongs.
  • Field Details

  • Method Details

    • appliesTo

      boolean appliesTo(Object request)
      Returns whether this request classifier applies to given request.
      Parameters:
      request - the request, never null
      Returns:
      whether this request classifier applies to given request
    • cohort

      int cohort(R request)
      Returns the cohort to which the given request belongs.
      Parameters:
      request - the request, never null
      Returns:
      the cohort to which the given request belongs