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

Remove Settings.getAsClass #12744

Merged
merged 1 commit into from Aug 10, 2015
Merged

Remove Settings.getAsClass #12744

merged 1 commit into from Aug 10, 2015

Conversation

rjernst
Copy link
Member

@rjernst rjernst commented Aug 8, 2015

This method on settings loaded a class, based on a setting value, using the default classloader. It had all kinds of leniency in how the classname was found, and simply cannot work with plugins having isolated classloaders.

This change removes that method. Some of the uses of it were for custom extension points, like custom repository or discovery types. A lot were just there to plugin mock implementations for tests. For the settings that were legitimate, all now support plugins adding the given setting via onModule. For those that were specific to tests for mocks, they now use Classes.loadClass (a helper around Class.forName). This is a temporary measure until (in a future PR) tests can change the implementation via package private statics.

I also removed a number of unnecessary intermediate modules, added a "jvm-example" plugin that can be filled in in the future as a smoke test for breaking plugins, and gave some documentation to "spawn" modules interface.

closes #12643
closes #12656

@dadoonet
Copy link
Member

dadoonet commented Aug 9, 2015

That's fantastic!
I just looked at the plugin part and it looks great to me.

@clintongormley clintongormley added >bug blocker review :Core/Infra/Core Core issues without another label labels Aug 9, 2015
@rmuir
Copy link
Contributor

rmuir commented Aug 9, 2015

+1

*/
public interface SpawnModules {
@Deprecated
public interface SpawnShittyModules {
Copy link
Contributor

Choose a reason for hiding this comment

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

sorry... -1 revert the name

Copy link
Contributor

Choose a reason for hiding this comment

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

yeah - no need to rename this

@s1monw
Copy link
Contributor

s1monw commented Aug 10, 2015

I left some comments other than that LGTM. I'd really like to work on making all our internally plugged in mock things a MockPlugin too in a followup to make sure we can plug them in and at the same time we exercising our plugin system from core

@rjernst
Copy link
Member Author

rjernst commented Aug 10, 2015

@uboness @s1monw I pushed new commits, removing the deprecation/rename and addressing other suggestions.

@s1monw
Copy link
Contributor

s1monw commented Aug 10, 2015

LGTM

@s1monw
Copy link
Contributor

s1monw commented Aug 10, 2015

this is a great step forward. Let's get rid of spawn modules altogether in a followup we need to flatten this hierarchy...

@s1monw
Copy link
Contributor

s1monw commented Aug 10, 2015

oh and please squash these - it's pretty unreadable list of commits :)

the default classloader. It had all kinds of leniency in how the
classname was found, and simply cannot work with plugins having isolated
classloaders.

This change removes that method. Some of the uses of it were for custom
extension points, like custom repository or discovery types. A lot were
just there to plugin mock implementations for tests. For the settings
that were legitimate, all now support plugins adding the given setting
via onModule. For those that were specific to tests for mocks, they now
use Classes.loadClass (a helper around Class.forName). This is a
temporary measure until (in a future PR) tests can change the
implementation via package private statics.

I also removed a number of unnecessary intermediate modules, added a
"jvm-example" plugin that can be filled in in the future as a smoke test
for breaking plugins, and gave some documentation to "spawn" modules
interface.

closes elastic#12643
closes elastic#12656
rjernst added a commit that referenced this pull request Aug 10, 2015
@rjernst rjernst merged commit bbf42d3 into elastic:master Aug 10, 2015
@rjernst rjernst mentioned this pull request Aug 10, 2015
@rjernst
Copy link
Member Author

rjernst commented Aug 10, 2015

I created #12783 as a follow up.

@rjernst
Copy link
Member Author

rjernst commented Aug 10, 2015

I also created #12784 to finish the test refactoring work here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Plugin entry points using Settings.getAsClass are broken Unable to start AWS discovery with 2.0.0-SNAPSHOT
7 participants