/**
   * Resolve IGFS profiler logs directory.
   *
   * @param igfs IGFS instance to resolve logs dir for.
   * @return {@link Path} to log dir or {@code null} if not found.
   * @throws IgniteCheckedException if failed to resolve.
   */
  public static Path resolveIgfsProfilerLogsDir(IgniteFileSystem igfs)
      throws IgniteCheckedException {
    String logsDir;

    if (igfs instanceof IgfsEx) logsDir = ((IgfsEx) igfs).clientLogDirectory();
    else if (igfs == null)
      throw new IgniteCheckedException(
          "Failed to get profiler log folder (IGFS instance not found)");
    else
      throw new IgniteCheckedException(
          "Failed to get profiler log folder (unexpected IGFS instance type)");

    URL logsDirUrl = U.resolveIgniteUrl(logsDir != null ? logsDir : DFLT_IGFS_LOG_DIR);

    return logsDirUrl != null ? new File(logsDirUrl.getPath()).toPath() : null;
  }
Example #2
0
  private void createConnection() throws IOException {
    String effectiveUrl = URLUtils.appendParametersToQueryString(url, querystringParams);
    if (connection == null) {
      System.setProperty("http.keepAlive", connectionKeepAlive ? "true" : "false");
      // connection = (HttpURLConnection) new URL(effectiveUrl).openConnection();

      URL url = new URL(effectiveUrl);
      if (url.getProtocol().toLowerCase().equals("https")) {
        trustAllHosts();
        HttpsURLConnection https = (HttpsURLConnection) url.openConnection();
        https.setHostnameVerifier(DO_NOT_VERIFY);
        connection = https;
      } else {
        connection = (HttpURLConnection) url.openConnection();
      }
    }
  }