Class LoadBalancerRetryContext
java.lang.Object
org.springframework.cloud.client.loadbalancer.reactive.LoadBalancerRetryContext
Stores the data for a load-balanced call that is being retried.
- Since:
- 3.0.0
- Author:
- Olga Maciaszek-Sharma
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedLoadBalancerRetryContext(org.springframework.web.reactive.function.client.ClientRequest request) -
Method Summary
Modifier and TypeMethodDescriptionprotected org.springframework.web.reactive.function.client.ClientResponseReturns theClientResponsereturned for load-balanced request.protected org.springframework.web.reactive.function.client.ClientRequestReturns theClientRequestthat is being load-balanced.protected org.springframework.http.HttpMethodReturns theHttpMethodof theClientRequestthat is being load-balanced.protected IntegerReturns the status code from theClientResponsereturned for load-balanced request.protected IntegerReturns the number of times a load-balanced request should be retried on the nextServiceInstance.protected IntegerReturns the number of times a load-balanced request should be retried on the sameServiceInstance.protected voidIncrements the counter for the retries executed against the sameServiceInstance.protected voidIncrements the counter for the retries executed against the sameServiceInstance.protected voidResets the counter for the retries executed against the sameServiceInstance.protected voidsetClientResponse(org.springframework.web.reactive.function.client.ClientResponse clientResponse) Sets theClientResponsereturned for load-balanced request.
-
Constructor Details
-
LoadBalancerRetryContext
protected LoadBalancerRetryContext(org.springframework.web.reactive.function.client.ClientRequest request)
-
-
Method Details
-
getRequest
protected org.springframework.web.reactive.function.client.ClientRequest getRequest()Returns theClientRequestthat is being load-balanced.- Returns:
- the request that is being load-balanced.
-
getClientResponse
protected org.springframework.web.reactive.function.client.ClientResponse getClientResponse()Returns theClientResponsereturned for load-balanced request.- Returns:
- the response for the load-balanced request.
-
setClientResponse
protected void setClientResponse(org.springframework.web.reactive.function.client.ClientResponse clientResponse) Sets theClientResponsereturned for load-balanced request.- Parameters:
clientResponse- the response for the load-balanced request.
-
getRetriesSameServiceInstance
Returns the number of times a load-balanced request should be retried on the sameServiceInstance.- Returns:
- the number of retries
-
incrementRetriesSameServiceInstance
protected void incrementRetriesSameServiceInstance()Increments the counter for the retries executed against the sameServiceInstance. -
resetRetriesSameServiceInstance
protected void resetRetriesSameServiceInstance()Resets the counter for the retries executed against the sameServiceInstance. -
getRetriesNextServiceInstance
Returns the number of times a load-balanced request should be retried on the nextServiceInstance.- Returns:
- the number of retries
-
incrementRetriesNextServiceInstance
protected void incrementRetriesNextServiceInstance()Increments the counter for the retries executed against the sameServiceInstance. -
getResponseStatusCode
Returns the status code from theClientResponsereturned for load-balanced request.- Returns:
- the status code from the response for the load-balanced request.
-
getRequestMethod
protected org.springframework.http.HttpMethod getRequestMethod()Returns theHttpMethodof theClientRequestthat is being load-balanced.- Returns:
- the HTTP method of the request that is being load-balanced.
-