Package com.helixframework.okhttp.sla
Class ServiceLevelAgreementInterceptor.Builder
java.lang.Object
com.helixframework.okhttp.sla.ServiceLevelAgreementInterceptor.Builder
- Enclosing class:
- ServiceLevelAgreementInterceptor
Builder for creating new instances of
ServiceLevelAgreementInterceptor.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionaction(BiConsumer<okhttp3.Request, Duration> action) The action to invoke when an SLA is broken.build()Builds an instance ofServiceLevelAgreementInterceptor.custom(BiPredicate<okhttp3.Request, Duration> predicate) Adds a custom predicate that determines if the SLA has been broken and the action should be invoked.Adds the collection of SLAs that will determine if the action is invoked.Adds an SLA for the path that will determine if the action is invoked.
-
Constructor Details
-
Builder
public Builder()
-
-
Method Details
-
path
Adds an SLA for the path that will determine if the action is invoked.- Parameters:
path- url path patternthreshold- sla threshold- Returns:
- this
ServiceLevelAgreementInterceptor.Builder
-
path
Adds the collection of SLAs that will determine if the action is invoked.- Parameters:
slas- slas- Returns:
- this
ServiceLevelAgreementInterceptor.Builder
-
custom
public ServiceLevelAgreementInterceptor.Builder custom(BiPredicate<okhttp3.Request, Duration> predicate) Adds a custom predicate that determines if the SLA has been broken and the action should be invoked.- Parameters:
predicate- sla predicate- Returns:
- this
ServiceLevelAgreementInterceptor.Builder
-
action
The action to invoke when an SLA is broken.- Parameters:
action- action- Returns:
- this
ServiceLevelAgreementInterceptor.Builder
-
build
Builds an instance ofServiceLevelAgreementInterceptor.- Returns:
- a
ServiceLevelAgreementInterceptor
-