Calling API (with rate of 5 calls/second) using Jersey client I am using the Jersey client to make API calls to validate a session. This call is being made at a rate of around 5 calls/second. I want to ensure that the client call doesn't have performance issues.

String sessionUrlPrefix = Config.getInstance().getString(Helper.SESSION_SERVICE_URL);
String urlParameters = getParameters(sessionId);
String sessionURL = sessionUrlPrefix + "?" + urlParameters;
WebResource webResource = client.resource(sessionURL);
logger.debug("Session URL is " + sessionURL);
ClientResponse response = webResource
    .accept(MediaType.TEXT_PLAIN_TYPE)
    .type(MediaType.TEXT_PLAIN_TYPE)
    .get(ClientResponse.class);

String responseStr = response.getEntity(String.class);
logger.debug("Response received is " + responseStr);
if (response.getStatus() != HttpStatus.OK.value())
{
    throw new RuntimeException("Failed : HTTP error code : " + response.getStatus());
    // Could throw more appropriate HttpException.
}
return responseStr;
I'm not familiar with Jersey at all, so just two generic notes:


You might want/could use HEAD instead GET which does not download the message body.
I don't know what is logging framework but if it's SLF4J you should use the {} pattern instead of string concatenation.

logger.debug("Session URL is {}", sessionURL);