Tabnine Logo
CouldNotConnectException
Code IndexAdd Tabnine to your IDE (free)

How to use
CouldNotConnectException
in
io.searchbox.client.config.exception

Best Java code snippets using io.searchbox.client.config.exception.CouldNotConnectException (Showing top 10 results out of 315)

origin: searchbox-io/Jest

removeNodeAndUpdateServers(cnce.getHost());
return;
origin: searchbox-io/Jest

@Override
public void failed(final Exception ex) {
  log.error("Exception occurred during async execution.", ex);
  if (ex instanceof HttpHostConnectException) {
    String host = ((HttpHostConnectException) ex).getHost().toURI();
    resultHandler.failed(new CouldNotConnectException(host, ex));
    return;
  }
  resultHandler.failed(ex);
}
origin: OpenNMS/opennms

@Override
public <T extends JestResult> T execute(JestClient client, Action<T> clientRequest) {
  do {
    LOG.debug("Executing request {}", clientRequest);
    try {
      T result = client.execute(clientRequest);
      return result;
    } catch (CouldNotConnectException connectException) {
      LOG.error("Could not connect to elastic endpoint: {}", connectException.getHost(), connectException);
    } catch (IOException ex) {
      LOG.error("Could not perform request {}: {}", clientRequest, ex.getMessage(), ex);
    } catch (com.google.gson.JsonSyntaxException gsonException) {
      LOG.error("A Json error occurred: {}", gsonException.getMessage(), gsonException);
    }
    // Retry-Logic
    LOG.debug("Request was not executed properly. Attempting Retry...");
    if (cooldownInMs > 0) {
      LOG.debug("Sleep " + cooldownInMs + " before retrying");
      try {
        Thread.sleep(cooldownInMs);
      } catch (InterruptedException e) {
        throw new RuntimeException("Thread interrupted.", e);
      }
    }
    LOG.debug("Retrying now");
  } while (true);
}
origin: searchbox-io/Jest

public <T extends JestResult> T execute(Action<T> clientRequest, RequestConfig requestConfig) throws IOException {
  HttpUriRequest request = prepareRequest(clientRequest, requestConfig);
  CloseableHttpResponse response = null;
  try {
    response = executeRequest(request);
    return deserializeResponse(response, request, clientRequest);
  } catch (HttpHostConnectException ex) {
    throw new CouldNotConnectException(ex.getHost().toURI(), ex);
  } finally {
    if (response != null) {
      try {
        response.close();
      } catch (IOException ex) {
        log.error("Exception occurred while closing response stream.", ex);
      }
    }
  }
}
origin: org.opennms.features.jest/org.opennms.features.jest.client

@Override
public <T extends JestResult> T execute(JestClient client, Action<T> clientRequest) {
  do {
    LOG.debug("Executing request {}", clientRequest);
    try {
      T result = client.execute(clientRequest);
      return result;
    } catch (CouldNotConnectException connectException) {
      LOG.error("Could not connect to elastic endpoint: {}", connectException.getHost(), connectException);
    } catch (IOException ex) {
      LOG.error("Could not perform request {}: {}", clientRequest, ex.getMessage(), ex);
    } catch (com.google.gson.JsonSyntaxException gsonException) {
      LOG.error("A Json error occurred: {}", gsonException.getMessage(), gsonException);
    }
    // Retry-Logic
    LOG.debug("Request was not executed properly. Attempting Retry...");
    if (cooldownInMs > 0) {
      LOG.debug("Sleep " + cooldownInMs + " before retrying");
      try {
        Thread.sleep(cooldownInMs);
      } catch (InterruptedException e) {
        throw new RuntimeException("Thread interrupted.", e);
      }
    }
    LOG.debug("Retrying now");
  } while (true);
}
origin: searchbox-io/Jest

public <T extends JestResult> T execute(Action<T> clientRequest, RequestConfig requestConfig) throws IOException {
  String elasticSearchRestUrl = getRequestURL(getNextServer(), clientRequest.getURI(ElasticsearchVersion.UNKNOWN));
  HttpUriRequest request = constructHttpMethod(clientRequest.getRestMethodName(), elasticSearchRestUrl, clientRequest.getData(gson), requestConfig);
  // add headers added to action
  if (!clientRequest.getHeaders().isEmpty()) {
    for (Map.Entry<String, Object> header : clientRequest.getHeaders().entrySet()) {
      request.addHeader(header.getKey(), header.getValue().toString());
    }
  }
  try {
    HttpResponse response = httpClient.execute(request);
    return deserializeResponse(response, clientRequest);
  } catch (HttpHostConnectException ex) {
    throw new CouldNotConnectException(ex.getHost().toURI(), ex);
  }
}
origin: io.searchbox/jest-common

removeNodeAndUpdateServers(cnce.getHost());
return;
origin: io.searchbox/jest

@Override
public void failed(final Exception ex) {
  log.error("Exception occurred during async execution.", ex);
  if (ex instanceof HttpHostConnectException) {
    String host = ((HttpHostConnectException) ex).getHost().toURI();
    resultHandler.failed(new CouldNotConnectException(host, ex));
    return;
  }
  resultHandler.failed(ex);
}
origin: org.graylog.jest/jest-common

removeNodeAndUpdateServers(cnce.getHost());
return;
origin: io.searchbox/jest

public <T extends JestResult> T execute(Action<T> clientRequest, RequestConfig requestConfig) throws IOException {
  HttpUriRequest request = prepareRequest(clientRequest, requestConfig);
  CloseableHttpResponse response = null;
  try {
    response = executeRequest(request);
    return deserializeResponse(response, request, clientRequest);
  } catch (HttpHostConnectException ex) {
    throw new CouldNotConnectException(ex.getHost().toURI(), ex);
  } finally {
    if (response != null) {
      try {
        response.close();
      } catch (IOException ex) {
        log.error("Exception occurred while closing response stream.", ex);
      }
    }
  }
}
io.searchbox.client.config.exceptionCouldNotConnectException

Javadoc

Wrapper for a the host address of an HTTPConnectException

Most used methods

  • getHost
  • <init>

Popular in Java

  • Start an intent from android
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • setRequestProperty (URLConnection)
  • setContentView (Activity)
  • FileNotFoundException (java.io)
    Thrown when a file specified by a program cannot be found.
  • HttpURLConnection (java.net)
    An URLConnection for HTTP (RFC 2616 [http://tools.ietf.org/html/rfc2616]) used to send and receive d
  • MessageDigest (java.security)
    Uses a one-way hash function to turn an arbitrary number of bytes into a fixed-length byte sequence.
  • Set (java.util)
    A Set is a data structure which does not allow duplicate elements.
  • Pattern (java.util.regex)
    Patterns are compiled regular expressions. In many cases, convenience methods such as String#matches
  • Filter (javax.servlet)
    A filter is an object that performs filtering tasks on either the request to a resource (a servlet o
  • Best IntelliJ plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now