Comcast / jrugged

A Java libary of robustness design patterns
Apache License 2.0
266 stars 93 forks source link

tripCount increments only if actually open circuit #33

Closed ggiamarchi closed 9 years ago

ggiamarchi commented 9 years ago

Fix #32

joercampbell commented 9 years ago

I think actually it might be better to check the state portion of this at the top of the method rather than after the state change/previous state capture.

public void trip() { if (state != BreakerState.OPEN) { openCount.getAndIncrement(); }

BreakerState previousState = state; state = BreakerState.OPEN; lastFailure.set(System.currentTimeMillis()); isAttemptLive = false; ....

Does this make sense?

ggiamarchi commented 9 years ago

You're right. Pull request updated.