Merge "Fix plugin reloading for DynamicItems" into stable-2.10

This commit is contained in:
Saša Živkov
2015-01-22 10:30:31 +00:00
committed by Gerrit Code Review

View File

@@ -184,7 +184,13 @@ public class DynamicItem<T> {
NamedProvider<T> old = null;
while (!ref.compareAndSet(old, item)) {
old = ref.get();
if (old != null && !"gerrit".equals(old.pluginName)) {
if (old != null
&& !"gerrit".equals(old.pluginName)
&& !pluginName.equals(old.pluginName)) {
// We allow to replace:
// 1. Gerrit core items, e.g. websession cache
// can be replaced by plugin implementation
// 2. Reload of current plugin
throw new ProvisionException(String.format(
"%s already provided by %s, ignoring plugin %s",
this.key.getTypeLiteral(), old.pluginName, pluginName));