Author: mrdon Date: Fri Dec 8 12:16:16 2006 New Revision: 484733 URL: http://svn.apache.org/viewvc?view=rev&rev=484733 Log: Tied object factory instance to dispatcher instance WW-1544
Modified: struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/Dispatcher.java Modified: struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/Dispatcher.java URL: http://svn.apache.org/viewvc/struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/Dispatcher.java?view=diff&rev=484733&r1=484732&r2=484733 ============================================================================== --- struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/Dispatcher.java (original) +++ struts/struts2/trunk/core/src/main/java/org/apache/struts2/dispatcher/Dispatcher.java Fri Dec 8 12:16:16 2006 @@ -169,6 +169,7 @@ public static void setInstance(Dispatcher instance) { Dispatcher.instance.set(instance); + // Tie the ObjectFactory threadlocal instance to this Dispatcher instance if (instance != null) { Container cont = instance.getContainer(); if (cont != null) { @@ -251,12 +252,12 @@ } /** - * Release local threads and destroy any DispatchListeners. + * Releases all instances bound to this dispatcher instance. */ public void cleanup() { // clean up ObjectFactory - ObjectFactory objectFactory = ObjectFactory.getObjectFactory(); + ObjectFactory objectFactory = getContainer().getInstance(ObjectFactory.class); if (objectFactory == null) { LOG.warn("Object Factory is null, something is seriously wrong, no clean up will be performed"); } @@ -269,9 +270,8 @@ LOG.error("exception occurred while destroying ObjectFactory ["+objectFactory+"]", e); } } - ObjectFactory.setObjectFactory(null); - // clean up Dispatcher itself + // clean up Dispatcher itself for this thread instance.set(null); // clean up DispatcherListeners