onnxruntime
c0fd2f78 - Java: avoid provider resource extraction when library already exists in onnxruntime.native.path (#27668)

Commit
70 days ago
Java: avoid provider resource extraction when library already exists in onnxruntime.native.path (#27668) ## Summary Fixes the Java native provider loading flow so that `extractProviderLibrary` checks `onnxruntime.native.path` before attempting extraction from classpath resources. Previously, when a provider library was already present in `onnxruntime.native.path`, the Java loader could still attempt `extractFromResources(...)` first, and only fall back to the configured native path afterwards. This caused an unnecessary extraction attempt even though the library was already available on disk. This change updates the lookup order to: 1. Return immediately if the provider was already marked as ready 2. Check whether the provider library already exists in `onnxruntime.native.path` 3. Only if not found there, attempt extraction from classpath resources ## Tests Added a regression test covering the case where the requested provider library already exists in `onnxruntime.native.path`. The test verifies that: - `extractProviderLibrary(...)` returns `true` - extraction from resources is not attempted in that case A small test-only hook was added to observe calls to `extractFromResources(...)` so the regression can be validated directly and deterministically. ## Issue Fixes #27655
Author
Parents
Loading