Skip to content

refactor(hints,wraps): lazy load native libraries #24734

Open
TRIVENI206 wants to merge 5 commits intohiero-ledger:mainfrom
TRIVENI206:fix-lazy-loading
Open

refactor(hints,wraps): lazy load native libraries #24734
TRIVENI206 wants to merge 5 commits intohiero-ledger:mainfrom
TRIVENI206:fix-lazy-loading

Conversation

@TRIVENI206
Copy link
Copy Markdown

Description:
Replace eager static initialization of HintsLibraryBridge and WRAPSLibraryBridge with lazy loading.

Previously, both native libraries were initialized at class load time, causing them to be loaded even when the corresponding feature flags (tss.hintsEnabled, tss.wrapsEnabled) were disabled. This led to unnecessary memory usage and increased startup overhead.

This change introduces lazy initialization using thread-safe getter methods, ensuring that the native libraries are only loaded when actually needed.

Replace static final initialization with lazy-loaded fields
Add thread-safe double-checked locking for initialization
Update all usages to use getter methods instead of static fields

Related issue(s):

Fixes #24693

Notes for reviewer:
This change replaces eager initialization of native libraries with lazy loading. No functional behavior was modified, and the change is limited to initialization timing.

Checklist

  • Documented (Code comments, README, etc.)
  • Tested (unit, integration, etc.)

Signed-off-by: TRIVENI206 <trivenireddy206@gmail.com>
@TRIVENI206 TRIVENI206 requested a review from a team as a code owner April 3, 2026 07:10
@trunk-io
Copy link
Copy Markdown

trunk-io bot commented Apr 3, 2026

Merging to main in this repository is managed by Trunk.

  • To merge this pull request, check the box to the left or comment /trunk merge below.

After your PR is submitted to the merge queue, this comment will be automatically updated with its status. If the PR fails, failure details will also be posted here

@lfdt-bot
Copy link
Copy Markdown

lfdt-bot commented Apr 3, 2026

Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

@codacy-production
Copy link
Copy Markdown

codacy-production bot commented Apr 3, 2026

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

TIP This summary will be updated as you push new changes. Give us feedback

@TRIVENI206 TRIVENI206 changed the title Fix: Lazy load Hints and Wraps native libraries refactor(hints,wraps): lazy load native libraries Apr 3, 2026
@TRIVENI206 TRIVENI206 changed the title refactor(hints,wraps): lazy load native libraries refactor(hints,wraps): lazy load native libraries #24693 Apr 3, 2026
@TRIVENI206 TRIVENI206 changed the title refactor(hints,wraps): lazy load native libraries #24693 refactor(hints,wraps): lazy load native libraries Apr 3, 2026
Signed-off-by: TRIVENI206 <trivenireddy206@gmail.com>
Signed-off-by: TRIVENI206 <trivenireddy206@gmail.com>
Signed-off-by: TRIVENI206 <trivenireddy206@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Lazy load Hints and Wrap native libraries

2 participants