made CircuitBreaker thread safe
This commit is contained in:
parent
5e4404c1b5
commit
a46e2c0b27
2 changed files with 2 additions and 2 deletions
|
@ -121,7 +121,7 @@ public final class CircuitBreaker<T> {
|
|||
return this.lastSuccessTime;
|
||||
}
|
||||
|
||||
public Result<T> protectedRun(final Supplier<T> supplier) {
|
||||
public synchronized Result<T> protectedRun(final Supplier<T> supplier) {
|
||||
final long currentTime = System.currentTimeMillis();
|
||||
|
||||
if (log.isDebugEnabled()) {
|
||||
|
|
|
@ -124,7 +124,7 @@ public final class MemoizingCircuitBreaker<T> implements Supplier<Result<T>> {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Result<T> get() {
|
||||
public synchronized Result<T> get() {
|
||||
final Result<T> result = this.delegate.protectedRun(this.supplier);
|
||||
if (result.hasError()) {
|
||||
if (this.memoizing && this.cached != null) {
|
||||
|
|
Loading…
Reference in a new issue