diff options
Diffstat (limited to 'src/com/vaadin')
-rw-r--r-- | src/com/vaadin/terminal/gwt/server/AbstractDeploymentConfiguration.java | 4 | ||||
-rw-r--r-- | src/com/vaadin/terminal/gwt/server/AddonContext.java | 8 |
2 files changed, 6 insertions, 6 deletions
diff --git a/src/com/vaadin/terminal/gwt/server/AbstractDeploymentConfiguration.java b/src/com/vaadin/terminal/gwt/server/AbstractDeploymentConfiguration.java index f731cbbdd0..7b51712904 100644 --- a/src/com/vaadin/terminal/gwt/server/AbstractDeploymentConfiguration.java +++ b/src/com/vaadin/terminal/gwt/server/AbstractDeploymentConfiguration.java @@ -124,8 +124,8 @@ public abstract class AbstractDeploymentConfiguration implements @Override public Iterator<AddonContextListener> getAddonContextListeners() { - // Called once for init and once for destroy, so it's probably not worth - // the effort caching the ServiceLoader instance + // Called once for init and then no more, so there's no point in caching + // the instance ServiceLoader<AddonContextListener> contextListenerLoader = ServiceLoader .load(AddonContextListener.class, getClassLoader()); return contextListenerLoader.iterator(); diff --git a/src/com/vaadin/terminal/gwt/server/AddonContext.java b/src/com/vaadin/terminal/gwt/server/AddonContext.java index 0f887b0fbd..41e9046e22 100644 --- a/src/com/vaadin/terminal/gwt/server/AddonContext.java +++ b/src/com/vaadin/terminal/gwt/server/AddonContext.java @@ -25,6 +25,8 @@ public class AddonContext { private List<BootstrapListener> bootstrapListeners = new ArrayList<BootstrapListener>(); + private List<AddonContextListener> initedListeners = new ArrayList<AddonContextListener>(); + public AddonContext(DeploymentConfiguration deploymentConfiguration) { this.deploymentConfiguration = deploymentConfiguration; deploymentConfiguration.setAddonContext(this); @@ -41,15 +43,13 @@ public class AddonContext { while (listeners.hasNext()) { AddonContextListener listener = listeners.next(); listener.contextCreated(event); + initedListeners.add(listener); } } public void destroy() { AddonContextEvent event = new AddonContextEvent(this); - Iterator<AddonContextListener> listeners = deploymentConfiguration - .getAddonContextListeners(); - while (listeners.hasNext()) { - AddonContextListener listener = listeners.next(); + for (AddonContextListener listener : initedListeners) { listener.contextDestoryed(event); } } |