@Override public synchronized void close() throws IOException { if (httpClient != null && httpClientCreated) { HttpClientUtils.closeQuietly(httpClient); } isClosed = true; }
@Override public void completed(HttpResponse response) { if (response.getStatusLine().getStatusCode() == HttpServletResponse.SC_OK) { serverIp2unhealthCount.put(serverIp, 0); if (serverListUnhealth.contains(serverIp)) { serverListUnhealth.remove(serverIp); } HttpClientUtils.closeQuietly(response); } }
HttpClientUtils.closeQuietly(response);
HttpClientUtils.closeQuietly(client); HttpClientUtils.closeQuietly(response);
protected void closeExternalClient() { if ( externalClient == null ) { return; } HttpClientUtils.closeQuietly(externalClient); externalClient = null; }
public static void closeConnections() { if (hc != null) { HttpClientUtils.closeQuietly(hc); hc = null; } }
@Override public void close() throws IOException { HttpClientUtils.closeQuietly(delegate); } }
@Override public void close() throws IOException { HttpClientUtils.closeQuietly(httpClient); } }
public void close() { HttpClientUtils.closeQuietly(this.response); }
public void shutdown() { HttpClientUtils.closeQuietly(this.httpClient); }
@Override public synchronized void shutDown() { if (executor != null) { executor.shutdown(); executor = null; } if (dependentClient != null) { HttpClientUtils.closeQuietly(dependentClient); dependentClient = null; } }
/** * @param httpClient * The httpClient to use for remote/service calls. */ public void setHttpClient(HttpClient httpClient) { synchronized (this) { this.httpClient = Objects.requireNonNull(httpClient, "HTTP Client cannot be null"); // If they set a client, we need to check whether we need to // close any existing dependentClient CloseableHttpClient toCloseDependentClient = dependentClient; dependentClient = null; if (toCloseDependentClient != null) { HttpClientUtils.closeQuietly(toCloseDependentClient); } } }
/** * @param httpClient * The httpClient to use for remote/service calls. */ public void setHttpClient(HttpClient httpClient) { synchronized (this) { this.httpClient = Objects.requireNonNull(httpClient, "HTTP Client cannot be null"); // If they set a client, we need to check whether we need to // close any existing dependentClient CloseableHttpClient toCloseDependentClient = dependentClient; dependentClient = null; if (toCloseDependentClient != null) { HttpClientUtils.closeQuietly(toCloseDependentClient); } } }
@Override public void completed(HttpResponse response) { if (response.getStatusLine().getStatusCode() == HttpServletResponse.SC_OK) { serverIp2unhealthCount.put(serverIp, 0); if (serverListUnhealth.contains(serverIp)) { serverListUnhealth.remove(serverIp); } HttpClientUtils.closeQuietly(response); } }
public void close() { HttpClientUtils.closeQuietly(httpClient); httpClient = null; if (exFuncs != null) { for (XProcExtensionFunctionDefinition xf : exFuncs) { xf.close(); } } exFuncs = null; }
public static String sendRecordingRequest(final String url) { CloseableHttpResponse response = null; try (final CloseableHttpClient client = HttpClientBuilder.create().build()) { final HttpGet get = new HttpGet(url); response = client.execute(get); HttpEntity content = response.getEntity(); String message = EntityUtils.toString(content); LOGGER.info("Response: " + message); return message; } catch (Exception ex) { LOGGER.severe("Request: " + ex); } finally { HttpClientUtils.closeQuietly(response); } return ""; }
public void close() { HttpClientUtils.closeQuietly(httpClient); httpClient = null; if (exFuncs != null) { for (XProcExtensionFunctionDefinition xf : exFuncs) { xf.close(); } } exFuncs = null; }
@Override public <T> T execute(HttpUriRequest request, HttpClientContext context, CredentialsProvider provider, RequestFunction<T> func) throws IOException, UnauthorizedAccessException { HttpClient client = HttpClientBuilder.create().setDefaultCredentialsProvider(provider).build(); try { return func.run(client.execute(request, context)); } finally { HttpClientUtils.closeQuietly(client); } } }
/** * Interface method implementation. Posts to Flux Runtime API to redrive a task. */ @Override public void redriveTask(String stateMachineId, Long taskId) { CloseableHttpResponse httpResponse = null; httpResponse = postOverHttp(null, "/redrivetask/" + stateMachineId + "/taskId/"+ taskId); HttpClientUtils.closeQuietly(httpResponse); }
/** * Interface method implementation. Increments the execution retries in persistence by invoking suitable Flux runtime API * @see com.flipkart.flux.client.runtime.FluxRuntimeConnector#incrementExecutionRetries(String, Long) */ @Override public void incrementExecutionRetries(String stateMachineId, Long taskId) { CloseableHttpResponse httpResponse = null; httpResponse = postOverHttp(null, "/" + stateMachineId + "/" + taskId + "/retries/inc"); HttpClientUtils.closeQuietly(httpResponse); }