c/src/main/java/org/apache/arrow/c/jni/JniLoader.java [59:109]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  private synchronized void loadRemaining() {
    // The method is protected by a mutex via synchronized, if more than one thread
    // race to call
    // loadRemaining, at same time only one will do the actual loading and the
    // others will wait for
    // the mutex to be acquired then check on the remaining list: if there are
    // libraries that were not
    // successfully loaded then the mutex owner will try to load them again.
    if (finished()) {
      return;
    }
    List<String> libs = new ArrayList<>(librariesToLoad);
    for (String lib : libs) {
      load(lib);
      librariesToLoad.remove(lib);
    }
  }

  private void load(String name) {
    final String libraryToLoad =
        name + "/" + getNormalizedArch() + "/" + System.mapLibraryName(name);
    try {
      File temp =
          File.createTempFile("jnilib-", ".tmp", new File(System.getProperty("java.io.tmpdir")));
      temp.deleteOnExit();
      try (final InputStream is =
          JniWrapper.class.getClassLoader().getResourceAsStream(libraryToLoad)) {
        if (is == null) {
          throw new FileNotFoundException(libraryToLoad);
        }
        Files.copy(is, temp.toPath(), StandardCopyOption.REPLACE_EXISTING);
        System.load(temp.getAbsolutePath());
      }
    } catch (IOException e) {
      throw new IllegalStateException("error loading native libraries: " + e);
    }
  }

  private String getNormalizedArch() {
    String arch = System.getProperty("os.arch").toLowerCase(Locale.US);
    switch (arch) {
      case "amd64":
        arch = "x86_64";
        break;
      case "aarch64":
        arch = "aarch_64";
        break;
      default:
        break;
    }
    return arch;
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



dataset/src/main/java/org/apache/arrow/dataset/jni/JniLoader.java [61:109]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  private synchronized void loadRemaining() {
    // The method is protected by a mutex via synchronized, if more than one thread race to call
    // loadRemaining, at same time only one will do the actual loading and the others will wait for
    // the mutex to be acquired then check on the remaining list: if there are libraries that were
    // not
    // successfully loaded then the mutex owner will try to load them again.
    if (finished()) {
      return;
    }
    List<String> libs = new ArrayList<>(librariesToLoad);
    for (String lib : libs) {
      load(lib);
      librariesToLoad.remove(lib);
    }
  }

  private void load(String name) {
    final String libraryToLoad =
        name + "/" + getNormalizedArch() + "/" + System.mapLibraryName(name);
    try {
      File temp =
          File.createTempFile("jnilib-", ".tmp", new File(System.getProperty("java.io.tmpdir")));
      temp.deleteOnExit();
      try (final InputStream is =
          JniWrapper.class.getClassLoader().getResourceAsStream(libraryToLoad)) {
        if (is == null) {
          throw new FileNotFoundException(libraryToLoad);
        }
        Files.copy(is, temp.toPath(), StandardCopyOption.REPLACE_EXISTING);
        System.load(temp.getAbsolutePath());
      }
    } catch (IOException e) {
      throw new IllegalStateException("error loading native libraries: " + e);
    }
  }

  private String getNormalizedArch() {
    String arch = System.getProperty("os.arch").toLowerCase(Locale.US);
    switch (arch) {
      case "amd64":
        arch = "x86_64";
        break;
      case "aarch64":
        arch = "aarch_64";
        break;
      default:
        break;
    }
    return arch;
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



