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

Make it possible for plugins to request a shared class loader #2508

Merged
merged 4 commits into from Jul 28, 2016

Conversation

Projects
None yet
2 participants
@bernd
Member

bernd commented Jul 20, 2016

In #2280 we changed the plugin loader so that all plugins share one class loader and they can see each other. (needed for plugin inter-dependencies)

This is problematic when different plugins have conflicting dependencies. (see #2436)

With this change, every plugin gets its own class loader by default so we can avoid dependency clashes. Plugins which depend on other plugins can request a shared class loader via a graylog-plugin.properties file.

Fixes #2436

@bernd bernd added this to the 2.1.0 milestone Jul 20, 2016

});
LOG.debug("Create shared class loader for {} plugins: {}", sharedClassLoaderUrls.size(), sharedClassLoaderUrls);
classLoader.addClassLoader(URLClassLoader.newInstance(sharedClassLoaderUrls.toArray(new URL[sharedClassLoaderUrls.size()])));

This comment has been minimized.

@kroepke

kroepke Jul 20, 2016

Member

Does this work properly when the array is empty?

This comment has been minimized.

@bernd

bernd Jul 22, 2016

Member

Good point. If there are no plugins which request a shared class loader, we should not add an empty one.

@kroepke kroepke self-assigned this Jul 25, 2016

bernd added some commits Jul 20, 2016

Make it possible for plugins to request a shared class loader
In #2280 we changed the plugin loader so that all plugins share one
class loader and they can see each other. (needed for plugin
inter-dependencies)

This is problematic when different plugins have conflicting
dependencies. (see #2436)

With this change, every plugin gets its own class loader by default so
we can avoid dependency clashes. Plugins which depend on other plugins
can request a shared class loader via a graylog-plugin.properties file.

Fixes #2436
Move properties file into a subdirectory to avoid clashes
The path to the properties file is stored in the
"Graylog-Plugin-Properties-Path" attribute of the JAR manifest.

@bernd bernd force-pushed the issue-2436 branch from 270c1b5 to 5c8c205 Jul 25, 2016

@kroepke

This comment has been minimized.

Member

kroepke commented Jul 28, 2016

lgtm

@kroepke kroepke merged commit 74690d1 into master Jul 28, 2016

4 checks passed

ci-server-integration Jenkins build graylog2-server-integration-pr 1157 has succeeded
Details
ci-web-linter Jenkins build graylog-pr-linter-check 641 has succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
continuous-integration/travis-ci/push The Travis CI build passed
Details

@kroepke kroepke deleted the issue-2436 branch Jul 28, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment