in grpc-gcp/src/main/java/com/google/cloud/grpc/multiendpoint/Endpoint.java [76:100]
void setAvailability(boolean available) {
synchronized (multiEndpoint) {
if (available) {
setState(EndpointState.AVAILABLE);
return;
}
if (state != null && !EndpointState.AVAILABLE.equals(state)) {
return;
}
if (!multiEndpoint.isRecoveryEnabled()) {
setState(EndpointState.UNAVAILABLE);
return;
}
setState(EndpointState.RECOVERING);
final long stateChangeNano = lastStateChangeNano;
changeStateFuture =
multiEndpoint.executor.schedule(
() -> triggerRecoveryTimeout(stateChangeNano),
multiEndpoint.getRecoveryTimeout().toMillis(),
MILLISECONDS);
}
}