CantosSong commented on PR #1777:
URL: https://github.com/apache/cxf/pull/1777#issuecomment-2837312086

   > > Isnt client executor the one to share and wire on httpclient? Httpclient 
itself does not abuse threads but uses the given ones - except for a few tasks 
but these ones will use common pool whatever you do
   > 
   > Executor is one thing (and we don't support that with any configuration at 
the moment) but the selector thread is created per client anyway.
   
   @jimma @reta 
   When I used version 4.0.4 without any issues, all subsequent versions had 
problems.
   
   If the address is modified, it will be released multiple times.
   
   
![image](https://github.com/user-attachments/assets/8f282ba8-c4de-4451-b2ca-a8f76c79b643)
   
   
![image](https://github.com/user-attachments/assets/eb11518a-b8de-4d8b-a492-e18f091e42d2)
   
   package com.shangrila.hotel.ca.service.web.tools;
   
   import jakarta.jws.WebMethod;
   import jakarta.jws.WebParam;
   import jakarta.jws.WebResult;
   import org.apache.commons.lang3.RandomUtils;
   import org.apache.cxf.binding.soap.SoapMessage;
   import org.apache.cxf.interceptor.Fault;
   import org.apache.cxf.jaxws.JaxWsProxyFactoryBean;
   import org.apache.cxf.phase.AbstractPhaseInterceptor;
   import org.apache.cxf.phase.Phase;
   
   import java.util.ArrayList;
   import java.util.List;
   
   public class TestCxf {
   
       public static void main(String[] args) throws InterruptedException {
           HTNGOutboundWebService byAddress = getByAddress();
           int i = 0;
           while (i <= 100) {
               Thread.ofVirtual().start(() -> {
                   try {
                       byAddress.ratePlanSubmitRequest("");
                   } catch (Exception e) {
                       if (!e.getCause().toString().contains("HTTP response")) {
                           e.printStackTrace();
                       }
                   }
               });
               i++;
           }
           Thread.sleep(100000);
       }
   
       public static class HTNGHeaderOutInterceptor1 extends 
AbstractPhaseInterceptor<SoapMessage> {
           static List<String> address = new ArrayList();
   
           public HTNGHeaderOutInterceptor1() {
               super(Phase.PREPARE_SEND);
               address.add("https://www.baidu.com";);
               address.add("https://www.tencent.com";);
           }
   
           @Override
           public void handleMessage(SoapMessage message) throws Fault {
               int i1 = RandomUtils.secure().randomInt(0, 2);
               message.put(org.apache.cxf.message.Message.ENDPOINT_ADDRESS, 
address.get(i1));
           }
       }
   
       public static HTNGOutboundWebService getByAddress() {
           JaxWsProxyFactoryBean jaxWsProxyFactoryBean = new 
JaxWsProxyFactoryBean();
           jaxWsProxyFactoryBean.setServiceClass(HTNGOutboundWebService.class);
           jaxWsProxyFactoryBean.getOutInterceptors().add(new 
HTNGHeaderOutInterceptor1());
   
           HTNGOutboundWebService soap = (HTNGOutboundWebService) 
jaxWsProxyFactoryBean.create();
           return soap;
       }
   
       public interface HTNGOutboundWebService {
           @WebMethod(operationName = "RatePlan_SubmitRequest", action = 
"http://htng.org/PWSWG/2010/12/RatePlan_SubmitRequest";)
           @WebResult(name = "OTA_HotelRatePlanNotifRS", targetNamespace = 
"http://www.opentravel.org/OTA/2003/05";, partName = "OTA_HotelRatePlanNotifRS")
           public void ratePlanSubmitRequest(
                   @WebParam(partName = "OTA_HotelRatePlanNotifRQ", name = 
"OTA_HotelRatePlanNotifRQ", targetNamespace = 
"http://www.opentravel.org/OTA/2003/05";)
                   String aa
           );
       }
   
   }
   


-- 
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: dev-unsubscr...@cxf.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to