Skip to content

Use ServiceLoader for ObjectFactory #1463

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

Conversation

nhojpatrick
Copy link
Member

Summary

Is this the type of changes you where expecting for #1450?

Details

Build fails at spring tests, but before I send more time is this what you where thinking?

How Has This Been Tested?

Not fully tested yet, tests are failing. Still work in process...

Types of changes

  • Bug fix (non-breaking change which fixes an issue).
  • New feature (non-breaking change which adds functionality).
  • Breaking change (fix or feature that would cause existing functionality to not work as expected).

Checklist:

  • I've added tests for my code.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.


public class ObjectFactoryLoader {

private static final ServiceLoader<ObjectFactory> LOADER = ServiceLoader.load(ObjectFactory.class);
Copy link
Contributor

Choose a reason for hiding this comment

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

The service loader is not safe for use by multiple concurrent threads. Runners are executed in parallel and each runner will create it's own backends with object factory. You can either make all fields and methods non-static or move this field into the method.

*
* @deprecated as of version 4.0.0; use {@code loadObjectFactory() } instead.
Copy link
Contributor

Choose a reason for hiding this comment

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

While currently not package private, the ObjectFactoryLoader will be after merging. There is no need to keep a deprecated method around.

@mpkorstanje
Copy link
Contributor

Build fails at spring tests, but before I send more time is this what you where thinking?

Looks exactly as expected! Thanks!

Btw. You'll notice that by adding whitespace changes in files that you otherwise didn't touch you'll now have merge conflicts. While I really appreciate the sentiment of cleaning things up, try to make these changes only in combination with other changes.

@nhojpatrick
Copy link
Member Author

yep i auto format style often without thing, sometimes i only do it so it appears in git as a file i need to go back to check later.

undone changes

…ervice-locator

# Conflicts:
#	core/src/test/java/cucumber/runtime/model/CucumberFeatureTest.java
@mpkorstanje
Copy link
Contributor

Merge remote-tracking branch 'upstream/master' into develop-v5_1450_s…

You may want to revert that commit and instead use upstream/develop-v5

mpkorstanje pushed a commit that referenced this pull request Nov 4, 2018
@mpkorstanje
Copy link
Contributor

I cherry picked your changes into a03dd01. Cheers!

@mpkorstanje mpkorstanje closed this Nov 4, 2018
@nhojpatrick nhojpatrick deleted the develop-v5_1450_service-locator branch November 8, 2018 08:24
@lock
Copy link

lock bot commented Nov 8, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Nov 8, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants