I have a Grails/Groovy application which is making use of the HTTPBuilder library to make calls to our application server. As resource utilization is going up, we are looking for a way to pool our HTTP connections. The only version of HTTPBuilder which supports pooling that I have found is AsyncHTTPBuilder, but our calls must be made synchronously. Does anyone have experience pooling connections with HTTPBuilder, or is there an alternate library we should be using to make our requests using pooled connections?
Here is an example of our usage of the HTTPBuilder library:
def get(event, request) {
def http = new HTTPBuilder(appServerURL)
def result = ""
http.client.cookieStore.addCookie
sessionHolderService.getVPMClientUser().apiSessionCookie
http.request(GET, TEXT) {
uri.path = "/path/on/appserver"
uri.query = [event: event, request: request, responseFormat: 'text/xml']
response.success = { resp, text ->
result = text.text
}
response.failure = { resp, text ->
result = text.text
throw new VPMClientException(resp.status, resp.message, text.text)
}
}
result
}