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

Ensure we only register native methods once #10876

Merged
merged 1 commit into from Dec 18, 2020
Merged

Ensure we only register native methods once #10876

merged 1 commit into from Dec 18, 2020

Conversation

normanmaurer
Copy link
Member

Motivation:

We need to ensure we only register native methods once as otherwise we may end up in an "invalid" state. The problem here was that before it was basically the responsibility the user of transport-native-unix-common to register the methods. This is error prone as there may be multiple users of these on the classpath at the same time.

Modifications:

  • Provide a way to init native lib without register the native methods of the provided classes. This is needed to be able to re-use functionality which is exposed to our internal native code
  • Use flatten plugin to correctly resolve classifier and so have the correct dependency
  • Call Unix.* method to ensure we register the methods correctly once
  • Include native lib as well in the native jars of unix-common

Result:

Be able to have multiple artifacts of the classpath that depends on the unix-common. Related to netty/netty-incubator-transport-io_uring#15

</executions>
</plugin>
</plugins>
</build>
Copy link
Member Author

Choose a reason for hiding this comment

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

Removed all this stuff as we can easily share it.

Motivation:

We need to ensure we only register native methods once as otherwise we may end up in an "invalid" state. The problem here was that before it was basically the responsibility the user of transport-native-unix-common to register the methods. This is error prone as there may be multiple users of these on the classpath at the same time.

Modifications:

- Provide a way to init native lib without register the native methods of the provided classes. This is needed to be able to re-use functionality which is exposed to our internal native code
- Use flatten plugin to correctly resolve classifier and so have the correct dependency
- Call Unix.* method to ensure we register the methods correctly once
- Include native lib as well in the native jars of unix-common

Result:

Be able to have multiple artifacts of the classpath that depends on the unix-common. Related to netty/netty-incubator-transport-io_uring#15
@normanmaurer normanmaurer merged commit 7fb62a9 into 4.1 Dec 18, 2020
@normanmaurer normanmaurer deleted the native_fix branch December 18, 2020 09:37
@normanmaurer normanmaurer added this to the 4.1.57.Final milestone Dec 18, 2020
normanmaurer added a commit that referenced this pull request Jan 13, 2021
Motivation:

This reverts commit 7fb62a9 as it broke native loading in some cases due maven dependencies.

Modification:

Revert the commit.

Result:

Native loading works again
normanmaurer added a commit that referenced this pull request Jan 13, 2021
Motivation:

This reverts commit 7fb62a9 as it broke native loading in some cases due maven dependencies.

Modification:

Revert the commit.

Result:

Native loading works again
ZzxyNn pushed a commit to ZzxyNn/netty that referenced this pull request Jan 29, 2021
…etty#10928)

Motivation:

This reverts commit 7fb62a9 as it broke native loading in some cases due maven dependencies.

Modification:

Revert the commit.

Result:

Native loading works again
raidyue pushed a commit to raidyue/netty that referenced this pull request Jul 8, 2022
Motivation:

We need to ensure we only register native methods once as otherwise we may end up in an "invalid" state. The problem here was that before it was basically the responsibility the user of transport-native-unix-common to register the methods. This is error prone as there may be multiple users of these on the classpath at the same time.

Modifications:

- Provide a way to init native lib without register the native methods of the provided classes. This is needed to be able to re-use functionality which is exposed to our internal native code
- Use flatten plugin to correctly resolve classifier and so have the correct dependency
- Call Unix.* method to ensure we register the methods correctly once
- Include native lib as well in the native jars of unix-common

Result:

Be able to have multiple artifacts of the classpath that depends on the unix-common. Related to netty/netty-incubator-transport-io_uring#15
raidyue pushed a commit to raidyue/netty that referenced this pull request Jul 8, 2022
…etty#10928)

Motivation:

This reverts commit 7fb62a9 as it broke native loading in some cases due maven dependencies.

Modification:

Revert the commit.

Result:

Native loading works again
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.

None yet

2 participants