We have an application REST gateway deployed over jetty 9.0.3 server.For authentication and authorization of services deployed in jetty is taken care by apache commons-httpclient3.1. when there are huge number of concurrent threads hitting Rest gateway, lot of CLOSE_WAIT are piling up in REST gateway machine. Http connections which are opened for sending request to enabler(END POINT)are closed properly by calling releaseConnections method of apache commons. Please let me know how to handle these CLOSE_WAIT or any clues why connections are ending up in CLOSE_WAIT.
The close_wait connections vanished when closeIdleConnections(0) provided by Apache commons http Client 3.1. But now too many TIME_WAIT are getting established and back end i am getting errors like "Address already in use" :(
Finally CLOSE_WAIT connections were not seen after using closeIdleConnections(0). Hope this solution might help others :)