Share via


CircuitBreakerPolicy Class

  • java.lang.Object
    • com.azure.resourcemanager.appcontainers.models.CircuitBreakerPolicy

Implements

public final class CircuitBreakerPolicy
implements JsonSerializable<CircuitBreakerPolicy>

Policy that defines circuit breaker conditions.

Constructor Summary

Constructor Description
CircuitBreakerPolicy()

Creates an instance of CircuitBreakerPolicy class.

Method Summary

Modifier and Type Method and Description
Integer consecutiveErrors()

Get the consecutiveErrors property: Number of consecutive errors before the circuit breaker opens.

static CircuitBreakerPolicy fromJson(JsonReader jsonReader)

Reads an instance of CircuitBreakerPolicy from the JsonReader.

Integer intervalInSeconds()

Get the intervalInSeconds property: The time interval, in seconds, between endpoint checks.

Integer maxEjectionPercent()

Get the maxEjectionPercent property: Maximum percentage of hosts that will be ejected after failure threshold has been met.

JsonWriter toJson(JsonWriter jsonWriter)
void validate()

Validates the instance.

CircuitBreakerPolicy withConsecutiveErrors(Integer consecutiveErrors)

Set the consecutiveErrors property: Number of consecutive errors before the circuit breaker opens.

CircuitBreakerPolicy withIntervalInSeconds(Integer intervalInSeconds)

Set the intervalInSeconds property: The time interval, in seconds, between endpoint checks.

CircuitBreakerPolicy withMaxEjectionPercent(Integer maxEjectionPercent)

Set the maxEjectionPercent property: Maximum percentage of hosts that will be ejected after failure threshold has been met.

Methods inherited from java.lang.Object

Constructor Details

CircuitBreakerPolicy

public CircuitBreakerPolicy()

Creates an instance of CircuitBreakerPolicy class.

Method Details

consecutiveErrors

public Integer consecutiveErrors()

Get the consecutiveErrors property: Number of consecutive errors before the circuit breaker opens.

Returns:

the consecutiveErrors value.

fromJson

public static CircuitBreakerPolicy fromJson(JsonReader jsonReader)

Reads an instance of CircuitBreakerPolicy from the JsonReader.

Parameters:

jsonReader - The JsonReader being read.

Returns:

An instance of CircuitBreakerPolicy if the JsonReader was pointing to an instance of it, or null if it was pointing to JSON null.

Throws:

IOException

- If an error occurs while reading the CircuitBreakerPolicy.

intervalInSeconds

public Integer intervalInSeconds()

Get the intervalInSeconds property: The time interval, in seconds, between endpoint checks. This can result in opening the circuit breaker if the check fails as well as closing the circuit breaker if the check succeeds. Defaults to 10s.

Returns:

the intervalInSeconds value.

maxEjectionPercent

public Integer maxEjectionPercent()

Get the maxEjectionPercent property: Maximum percentage of hosts that will be ejected after failure threshold has been met.

Returns:

the maxEjectionPercent value.

toJson

public JsonWriter toJson(JsonWriter jsonWriter)

Parameters:

jsonWriter

Throws:

validate

public void validate()

Validates the instance.

withConsecutiveErrors

public CircuitBreakerPolicy withConsecutiveErrors(Integer consecutiveErrors)

Set the consecutiveErrors property: Number of consecutive errors before the circuit breaker opens.

Parameters:

consecutiveErrors - the consecutiveErrors value to set.

Returns:

the CircuitBreakerPolicy object itself.

withIntervalInSeconds

public CircuitBreakerPolicy withIntervalInSeconds(Integer intervalInSeconds)

Set the intervalInSeconds property: The time interval, in seconds, between endpoint checks. This can result in opening the circuit breaker if the check fails as well as closing the circuit breaker if the check succeeds. Defaults to 10s.

Parameters:

intervalInSeconds - the intervalInSeconds value to set.

Returns:

the CircuitBreakerPolicy object itself.

withMaxEjectionPercent

public CircuitBreakerPolicy withMaxEjectionPercent(Integer maxEjectionPercent)

Set the maxEjectionPercent property: Maximum percentage of hosts that will be ejected after failure threshold has been met.

Parameters:

maxEjectionPercent - the maxEjectionPercent value to set.

Returns:

the CircuitBreakerPolicy object itself.

Applies to