-
Notifications
You must be signed in to change notification settings - Fork 183
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
Changing instances of ExecutorExtension to static #2088
Conversation
Related to #2074 |
Thank you! In addition to marking the instances |
Sure, I'm on it! You're welcome |
15f2e64
to
3b2e2f3
Compare
Commit updated |
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.
Thank you for the PR @gabAlek!
Please check build failures, there are some violations of checkstyle rules. You can test it locally with ./gradlew checkstyle
or ./gradlew build
before pushing an update.
@@ -80,7 +80,7 @@ | |||
static final ExecutorExtension<Executor> EXECUTOR_EXTENSION = withCachedExecutor().setClassLevel(true); | |||
|
|||
@RegisterExtension | |||
final ExecutorExtension<TestExecutor> testExecutorExtension = withTestExecutor(); | |||
static final ExecutorExtension<TestExecutor> testExecutorExtension = withTestExecutor(); |
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.
If we can not use .setClassLevel(true)
in this case or any other, it's better to keep it as non-static variable. Otherwise, it's harder to understand the test flow and when this extension is re-initialized.
3b2e2f3
to
29eabfd
Compare
Commit updated!Thank you for the suggestions, @idelpivnitskiy |
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.
Excellent work! This is getting very close to completion. Thank you!
...-api/src/test/java/io/servicetalk/concurrent/api/completable/CompletableToPublisherTest.java
Outdated
Show resolved
Hide resolved
...ent-api/src/test/java/io/servicetalk/concurrent/api/completable/CompletableToSingleTest.java
Outdated
Show resolved
Hide resolved
...concurrent-api/src/test/java/io/servicetalk/concurrent/api/single/SingleToPublisherTest.java
Outdated
Show resolved
Hide resolved
Motivation: To potentially reduce the overhead of instantiating the ExecutorExtension class repeatedly between test cases. Modifications: Changed instances of ExecutorExtension to static, except for classes where said instances were created with a TestExecutor (which caused unit tests to break). Result: All instances of the ExecutorExtension are now static inside servicetalk-concurrent-api module test classes. Instances that were not created with TestExecutor were set to class level.
29eabfd
to
d82d260
Compare
Thank you Gabriel! |
Motivation:
To potentially reduce the overhead of instantiating the ExecutorExtension class repeatedly between test cases.
Modifications:
Changed instances of ExecutorExtension to static
Result:
All instances of the ExecutorExtension are now static inside servicetalk-concurrent-api module test classes.