В случае с Resilience4J предохранитель работает как конечный автомат с тремя нормальными состояниями:
и двумя специальными: DISABLED
& FORCED_OPEN
.
Дальше будет описана логика работы предохранителя в привязке к его конфигурируемым параметрам.
Предохранитель постоянно анализирует результаты проходящих через него вызовов и накапливает их в т.н. скользящем окне. Окна бывают двух типов в зависимости от параметра slidingWindowType
: