59 |
|
|
60 |
this.name = name; |
this.name = name; |
61 |
|
|
62 |
// Initial state is closed - like a reset() was called initially |
//set correct intial state |
63 |
closed.resetFailureCount(); |
internalReset(); |
|
currentState = closed; |
|
64 |
} |
} |
65 |
|
|
66 |
|
|
105 |
public void reset() { |
public void reset() { |
106 |
synchronized(this) { |
synchronized(this) { |
107 |
if (currentState != closed) { // TODO: Is this conditional necessary ?? |
if (currentState != closed) { // TODO: Is this conditional necessary ?? |
108 |
closed.resetFailureCount(); |
internalReset(); |
|
currentState = closed; |
|
109 |
notifier.sendNotification(name, Notifier.Event.BreakerReset); |
notifier.sendNotification(name, Notifier.Event.BreakerReset); |
110 |
} |
} |
111 |
} |
} |
112 |
} |
} |
113 |
|
|
114 |
|
//This one actually sets the correct closed/reset state |
115 |
|
private void internalReset() { |
116 |
|
closed.resetFailureCount(); |
117 |
|
currentState = closed; |
118 |
|
} |
119 |
|
|
120 |
|
|
121 |
private CircuitBreakerState getState() { |
private CircuitBreakerState getState() { |
122 |
synchronized(this) { |
synchronized(this) { |