diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/plugins/PluginGuiceEnvironment.java b/gerrit-server/src/main/java/com/google/gerrit/server/plugins/PluginGuiceEnvironment.java index 5491e14963..5b63a21561 100644 --- a/gerrit-server/src/main/java/com/google/gerrit/server/plugins/PluginGuiceEnvironment.java +++ b/gerrit-server/src/main/java/com/google/gerrit/server/plugins/PluginGuiceEnvironment.java @@ -217,10 +217,6 @@ public class PluginGuiceEnvironment { } void onStartPlugin(Plugin plugin) { - for (StartPluginListener l : onStart) { - l.onStartPlugin(plugin); - } - RequestContext oldContext = enter(plugin); try { attachItem(sysItems, plugin.getSysInjector(), plugin); @@ -237,6 +233,10 @@ public class PluginGuiceEnvironment { } finally { exit(oldContext); } + + for (StartPluginListener l : onStart) { + l.onStartPlugin(plugin); + } } void onStopPlugin(Plugin plugin) { @@ -273,10 +273,6 @@ public class PluginGuiceEnvironment { } void onReloadPlugin(Plugin oldPlugin, Plugin newPlugin) { - for (ReloadPluginListener l : onReload) { - l.onReloadPlugin(oldPlugin, newPlugin); - } - // Index all old registrations by the raw type. These may be replaced // during the reattach calls below. Any that are not replaced will be // removed when the old plugin does its stop routine. @@ -302,6 +298,10 @@ public class PluginGuiceEnvironment { } finally { exit(oldContext); } + + for (ReloadPluginListener l : onReload) { + l.onReloadPlugin(oldPlugin, newPlugin); + } } private void reattachMap(