You need to close your client object that you created in the calling method. In the calling method you will have something like below -
Client client = ClientBuilder.newClient(); WebTarget webTarget = client.target(SERVER_URL).path(API_PATH).path(String.valueOf(id)); fire(webTarget);
So you need to close client after calling this method -
client.close()
However, the recommended way to close client is after receiving a response. Something like below -
public void fire(WebTarget webTarget) { try { webTarget.request(MediaType.APPLICATION_JSON_TYPE) .accept(MediaType.APPLICATION_JSON_TYPE) .headers(headers) .async().get(new InvocationCallback<Response>() { @Override public void completed(Response response) {
source share