title: too many open files while using JAX-WS client
body: <p>I am having an application which communicates to a remote web server using a JAX-WS based client. The problem I am facing is that the application is not properly closing the HTTP connections after a request is completed. The sockets are in CLOSED_WAIT state. The out of the lsof -p  is as follows with all the sockets in CLOSED_WAIT:</p>
  
  <p>52u  IPv6            6467002                  TCP gsilin2.india.com:31842->gsilin2.india.com:7073 (CLOSE_WAIT)
   53u  IPv6            6467357                  TCP gsilin2.india.com:31970->gsilin2.india.com:7073 (CLOSE_WAIT)
   54u  IPv6            6467480                  TCP gsilin2.india.com:32015->gsilin2.india.com:7073 (CLOSE_WAIT)
   55u  IPv6            6467368                  TCP gsilin2.india.com:31974->gsilin2.india.com:7073 (CLOSE_WAIT)</p>
  
  <p>Form the above scenario, my understanding is that JAX-WS internally is not closing the underlying HTTP connetions. The following is a code snippet that has been used in the application.</p>
  
  <pre><code>    BindingProvider bindingProvider = (BindingProvider)atuaPortType;
      bindingProvider.getBinding().setHandlerChain(handlerChain);
      Map&lt;String, Object&gt; map=bindingProvider.getRequestContext();  
      .....
      .....  
  
      map.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, serverurl);
      Map map1 = new HashMap();
      map1.put("Connection", Collections.singletonList("close"));
      map.put(MessageContext.HTTP_REQUEST_HEADERS, map1);
  </code></pre>
  
  <p>When the application has to send more requests to the web server, the application is being crashed with "too many open files" error. I am not finding any solution. </p>
  
  <p>Please help me to resolve the issue.</p>
  
  <p>Thanks in advance.</p>
  
  <p>Chandan Talukdar,
  Bangalore, India</p>