Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modify AppDirsFactory.getInstance() to return the singleton instance #118

Merged
merged 1 commit into from
Feb 26, 2025

Conversation

harawata
Copy link
Owner

I couldn't verify whether WindowsAppDirs is thread-safe or not.
It looks reasonable to assume it is, but if the assumption is wrong, we might have to revert this.

This won't break any existing solutions, but I plan to bump the minor version to 1.4.0 just in case.

Should fix #117

Cc: @koppor

I am not entirely sure if `WindowsAppDirs` is thread-safe or not.
It looks reasonable to assume it is, but if the assumption is wrong, I might have to revert this.
@harawata harawata self-assigned this Feb 26, 2025
}

/** Singleton instance holder. */
private static class Holder {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Owner Author

@harawata harawata Feb 26, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure if we can apply the enum singleton here.
If you have a clear idea, could you show me the essential part? (or send a PR if you prefer)

@koppor
Copy link

koppor commented Feb 26, 2025

I couldn't verify whether WindowsAppDirs is thread-safe or not. It looks reasonable to assume it is, but if the assumption is wrong, we might have to revert this.

If it is not thread safe, one could make use of synchronized maybe?

This won't break any existing solutions, but I plan to bump the minor version to 1.4.0 just in case.

Yeah, sounds good!

Thank you for the quick action taken!

@harawata harawata merged commit 392e453 into master Feb 26, 2025
18 checks passed
@harawata harawata modified the milestone: 1.4.0 Feb 26, 2025
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.

getInstance should re-use an existing instance
2 participants