Class LoadBalancerRetryContext
- java.lang.Object
-
- org.springframework.cloud.client.loadbalancer.reactive.LoadBalancerRetryContext
-
public class LoadBalancerRetryContext extends Object
Stores the data for a load-balanced call that is being retried.- Since:
- 3.0.0
- Author:
- Olga Maciaszek-Sharma
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
LoadBalancerRetryContext(org.springframework.web.reactive.function.client.ClientRequest request)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected org.springframework.web.reactive.function.client.ClientResponse
getClientResponse()
Returns theClientResponse
returned for load-balanced request.protected org.springframework.web.reactive.function.client.ClientRequest
getRequest()
Returns theClientRequest
that is being load-balanced.protected org.springframework.http.HttpMethod
getRequestMethod()
Returns theHttpMethod
of theClientRequest
that is being load-balanced.protected Integer
getResponseStatusCode()
Returns the status code from theClientResponse
returned for load-balanced request.protected Integer
getRetriesNextServiceInstance()
Returns the number of times a load-balanced request should be retried on the nextServiceInstance
.protected Integer
getRetriesSameServiceInstance()
Returns the number of times a load-balanced request should be retried on the sameServiceInstance
.protected void
incrementRetriesNextServiceInstance()
Increments the counter for the retries executed against the sameServiceInstance
.protected void
incrementRetriesSameServiceInstance()
Increments the counter for the retries executed against the sameServiceInstance
.protected void
resetRetriesSameServiceInstance()
Resets the counter for the retries executed against the sameServiceInstance
.protected void
setClientResponse(org.springframework.web.reactive.function.client.ClientResponse clientResponse)
Sets theClientResponse
returned for load-balanced request.
-
-
-
Method Detail
-
getRequest
protected org.springframework.web.reactive.function.client.ClientRequest getRequest()
Returns theClientRequest
that is being load-balanced.- Returns:
- the request that is being load-balanced.
-
getClientResponse
protected org.springframework.web.reactive.function.client.ClientResponse getClientResponse()
Returns theClientResponse
returned 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 theClientResponse
returned for load-balanced request.- Parameters:
clientResponse
- the response for the load-balanced request.
-
getRetriesSameServiceInstance
protected Integer 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
protected Integer 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
protected Integer getResponseStatusCode()
Returns the status code from theClientResponse
returned for load-balanced request.- Returns:
- the status code from the response for the load-balanced request.
-
getRequestMethod
protected org.springframework.http.HttpMethod getRequestMethod()
Returns theHttpMethod
of theClientRequest
that is being load-balanced.- Returns:
- the HTTP method of the request that is being load-balanced.
-
-