ffang commented on code in PR #3656:
URL: https://github.com/apache/cxf/pull/3656#discussion_r4429644246


##########
systests/jaxrs/src/test/java/org/apache/cxf/systest/jaxrs/failover/AbstractFailoverTest.java:
##########
@@ -238,6 +238,9 @@ protected void strategyTest(String inactiveReplica,
 
         for (int i = 0; i < 20; i++) {
             if (!singleProxy) {
+                if (bookStore != null) {
+                    WebClient.client(bookStore).close();
+                }
                 feature.getTargetSelector().close();
                 bookStore = getBookStore(inactiveReplica, feature);

Review Comment:
   Thanks @reta, done by 
https://github.com/apache/cxf/pull/3656/commits/55d184b7a6
   
   `BookStore` is a proxy class rather than `AutoCloseable`, so the 
try-with-resources holds its `Client` instead (`WebClient.client(bookStore)`), 
which closes the proxy:
   
   ```java
   try (Client client = singleProxy ? null : WebClient.client(bookStore)) {
   ```
   
   In the `singleProxy` case one proxy is used by all iterations, so it isn't 
closed after each one. `LoadDistributorTest` has its own `strategyTest` with 
the same pattern, so its proxies are now closed the same way.
   
   Freeman



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to