File tree Expand file tree Collapse file tree 4 files changed +25
-4
lines changed
main/java/com/mageddo/dnsproxyserver/solver/remote/application/failsafe
test/java/com/mageddo/dnsproxyserver/solver/remote/application/failsafe Expand file tree Collapse file tree 4 files changed +25
-4
lines changed Original file line number Diff line number Diff line change 1+ ## 3.25.14
2+ * Fixing SolverRemote NPE #533
3+
14## 3.25.13
25* Unifying circuit breaker abstractions #553
36
Original file line number Diff line number Diff line change 1- version =3.25.13 -snapshot
1+ version =3.25.14 -snapshot
Original file line number Diff line number Diff line change @@ -99,16 +99,23 @@ public List<Stats> stats() {
9999 }
100100
101101 public CircuitStatus findStatus (InetSocketAddress remoteAddress ) {
102- return this .circuitBreakerMap .get (remoteAddress )
103- .findStatus ();
102+ final var circuitBreaker = this .findCircuitBreakerFromCache (remoteAddress );
103+ if (circuitBreaker == null ) {
104+ return null ;
105+ }
106+ return circuitBreaker .findStatus ();
104107 }
105108
106109 private Stats toStats (InetSocketAddress remoteAddr ) {
107- final var circuitBreaker = this .circuitBreakerMap . get (remoteAddr );
110+ final var circuitBreaker = this .findCircuitBreakerFromCache (remoteAddr );
108111 final var state = circuitBreaker .findStatus ().name ();
109112 return Stats .of (remoteAddr .toString (), state );
110113 }
111114
115+ private CircuitBreakerDelegate findCircuitBreakerFromCache (InetSocketAddress remoteAddress ) {
116+ return this .circuitBreakerMap .get (remoteAddress );
117+ }
118+
112119 @ Value
113120 public static class Stats {
114121
Original file line number Diff line number Diff line change 1414
1515import static org .junit .jupiter .api .Assertions .assertEquals ;
1616import static org .junit .jupiter .api .Assertions .assertNotEquals ;
17+ import static org .junit .jupiter .api .Assertions .assertNull ;
1718import static org .mockito .ArgumentMatchers .any ;
1819import static org .mockito .Mockito .doReturn ;
1920import static org .mockito .Mockito .mock ;
@@ -130,4 +131,14 @@ void mustBuildNonResilientCircuitBreaker(){
130131
131132 }
132133
134+ @ Test
135+ void mustReturnNullWhenNoStatusIsFound (){
136+
137+ final var addr = InetSocketAddressTemplates ._8_8_8_8 ();
138+
139+ final var status = this .factory .findStatus (addr );
140+
141+ assertNull (status );
142+ }
143+
133144}
You can’t perform that action at this time.
0 commit comments