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
KAFKA-15150: Add ServiceLoaderScanner implementation #13971
KAFKA-15150: Add ServiceLoaderScanner implementation #13971
Conversation
@C0urante Could you review this? Thanks! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks Greg! A couple of nits and one question about testing methodology, then this should be good to go.
connect/runtime/src/main/java/org/apache/kafka/connect/runtime/isolation/ReflectionScanner.java
Outdated
Show resolved
Hide resolved
connect/runtime/src/test/java/org/apache/kafka/connect/runtime/isolation/PluginScannerTest.java
Outdated
Show resolved
Hide resolved
connect/runtime/src/test/java/org/apache/kafka/connect/runtime/isolation/PluginScannerTest.java
Outdated
Show resolved
Hide resolved
Signed-off-by: Greg Harris <greg.harris@aiven.io>
Signed-off-by: Greg Harris <greg.harris@aiven.io>
Signed-off-by: Greg Harris <greg.harris@aiven.io>
Signed-off-by: Greg Harris <greg.harris@aiven.io>
This appears to have some JDK8 failures that look consistent that i'll have to replicate locally. I've been testing with JDK11, so it's possible that the JDK8 ServiceLoader has some slightly different behavior, since it was overhauled in JDK9. |
…next Signed-off-by: Greg Harris <greg.harris@aiven.io>
Tested the latest commit locally with OpenJDK 8 and 17; everything passes fine. Left one last comment but once that's addressed, this is good to go. Thanks for the diligent work on this, Greg! |
Signed-off-by: Greg Harris <greg.harris@aiven.io>
Signed-off-by: Greg Harris <greg.harris@aiven.io>
connect/runtime/src/main/java/org/apache/kafka/connect/runtime/isolation/PluginScanner.java
Outdated
Show resolved
Hide resolved
…r better log messages Signed-off-by: Greg Harris <greg.harris@aiven.io>
Signed-off-by: Greg Harris <greg.harris@aiven.io>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks Greg. I really want to merge this but have some final thoughts. I promise this is it, though!
connect/runtime/src/main/java/org/apache/kafka/connect/runtime/isolation/PluginScanner.java
Outdated
Show resolved
Hide resolved
connect/runtime/src/main/java/org/apache/kafka/connect/runtime/isolation/PluginScanner.java
Show resolved
Hide resolved
connect/runtime/src/main/java/org/apache/kafka/connect/runtime/isolation/PluginScanner.java
Outdated
Show resolved
Hide resolved
connect/runtime/src/main/java/org/apache/kafka/connect/runtime/isolation/PluginScanner.java
Outdated
Show resolved
Hide resolved
connect/runtime/src/main/java/org/apache/kafka/connect/runtime/isolation/ReflectionScanner.java
Outdated
Show resolved
Hide resolved
…tements Signed-off-by: Greg Harris <greg.harris@aiven.io>
Signed-off-by: Greg Harris <greg.harris@aiven.io>
Signed-off-by: Greg Harris <greg.harris@aiven.io>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM (pending CI build). Thanks Greg, this was a tricky one!
…e-loader-scanner Signed-off-by: Greg Harris <greg.harris@aiven.io>
Flaky test failures appear unrelated. |
Reviewers: Chris Egerton <chris.egerton@aiven.io>
Reviewers: Chris Egerton <chris.egerton@aiven.io>
Reviewers: Chris Egerton <chris.egerton@aiven.io>
Add the ServiceLoaderScanner, a companion to the ReflectionScanner which does not use reflection to discover plugins.
This will be utilized later in the Plugins class for the configurable-discovery-mode startup scanning, and in the connect-plugin-path script for manifest generation. In this PR, the PluginScannerTest is parameterized to ensure that the ServiceLoaderScanner has parity on the TestPlugins. This required adding manifests for the valid TestPlugins.
Also fixes a bug where the ServiceLoader handles plugin LinkageErrors differently than Reflections. To summarize:
Before:
After:
Committer Checklist (excluded from commit message)