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

Avoid static state #6

Merged
merged 1 commit into from
Mar 24, 2021
Merged

Avoid static state #6

merged 1 commit into from
Mar 24, 2021

Conversation

ejona86
Copy link
Member

@ejona86 ejona86 commented Mar 24, 2021

Motivation:

When statically compiled, the same netty-jni-util may be used by
multiple separate JNI libraries. In this situation there is only one
copy of static variables, so it is only safe to use static variables in
cases where they can safely be reused. That's not the case for the
current staticPackagePrefix.

Modifications:

Force the caller to manage the static state, which can be unique per
usage.

Result:

Static compilation is available again for JNI libraries that supported
static compilation before depending on netty-jni-util. Fixes #5.

Motivation:

When statically compiled, the same netty-jni-util may be used by
multiple separate JNI libraries. In this situation there is only one
copy of static variables, so it is only safe to use static variables in
cases where they can safely be reused. That's not the case for the
current staticPackagePrefix.

Modifications:

Force the caller to manage the static state, which can be unique per
usage.

Result:

Static compilation is available again for JNI libraries that supported
static compilation before depending on netty-jni-util. Fixes netty#5.
@ejona86
Copy link
Member Author

ejona86 commented Mar 24, 2021

FYI, I don't have write permission to this repo.

@normanmaurer normanmaurer merged commit b525c10 into netty:main Mar 24, 2021
@normanmaurer
Copy link
Member

@ejona86 now you have

@ejona86 ejona86 deleted the no-static-state branch August 24, 2021 23:48
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.

netty-jni-util is incompatible with static compilation
2 participants