cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject svn commit: r326102 - in /cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon: components/persistence/ portal/coplet/adapter/impl/ portal/impl/ portal/util/ portal/wsrp/adapter/
Date Tue, 18 Oct 2005 13:29:24 GMT
Author: cziegeler
Date: Tue Oct 18 06:29:15 2005
New Revision: 326102

URL: http://svn.apache.org/viewcvs?rev=326102&view=rev
Log:
Clean up usage of thread locals

Modified:
    cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/components/persistence/CastorSourceConverter.java
    cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/coplet/adapter/impl/PortletAdapter.java
    cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/impl/PortletPortalManager.java
    cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/util/ReferenceFieldHandler.java
    cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/wsrp/adapter/WSRPAdapter.java

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/components/persistence/CastorSourceConverter.java
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/components/persistence/CastorSourceConverter.java?rev=326102&r1=326101&r2=326102&view=diff
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/components/persistence/CastorSourceConverter.java
(original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/components/persistence/CastorSourceConverter.java
Tue Oct 18 06:29:15 2005
@@ -82,6 +82,8 @@
             return result;
         } catch (Exception e) {
             throw new ConverterException(e.getMessage(), e);
+        } finally {
+            ReferenceFieldHandler.clearObjectMap();
         }
     }
 

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/coplet/adapter/impl/PortletAdapter.java
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/coplet/adapter/impl/PortletAdapter.java?rev=326102&r1=326101&r2=326102&view=diff
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/coplet/adapter/impl/PortletAdapter.java
(original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/coplet/adapter/impl/PortletAdapter.java
Tue Oct 18 06:29:15 2005
@@ -83,8 +83,6 @@
     extends AbstractCopletAdapter
     implements Contextualizable, Initializable, PortalManagerAspect, Receiver, Disposable
{
 	
-    public final ThreadLocal copletInstanceData = new InheritableThreadLocal();
-
     /** The avalon context */
     protected Context context;
     
@@ -152,7 +150,6 @@
                 objectModel.put("portlet-request",  req);                
             }
             final HttpServletResponse res = (HttpServletResponse) objectModel.get("portlet-response");
-            this.copletInstanceData.set(coplet);
             try {
                 this.portletContainer.portletLoad(portletWindow, req.getRequest(portletWindow),
 
                                                   res);
@@ -161,8 +158,6 @@
                 // remove portlet entity
                 coplet.removeTemporaryAttribute("window");
                 ((PortletEntityListImpl)pae.getPortletEntityList()).remove(portletEntity);
-            } finally {
-                this.copletInstanceData.set(null);
             }
         }
     }
@@ -189,7 +184,6 @@
             final Map objectModel = ContextHelper.getObjectModel(this.context);
             final ServletRequestImpl  req = (ServletRequestImpl) objectModel.get("portlet-request");
             final HttpServletResponse res = (HttpServletResponse) objectModel.get("portlet-response");
-            this.copletInstanceData.set(coplet);
             
             // TODO - for parallel processing we have to clone the response!
             this.portletContainer.renderPortlet(window, req.getRequest(window), res);
@@ -214,8 +208,6 @@
             throw se;
         } catch (Exception e) {
             throw new SAXException(e);
-        } finally {
-            this.copletInstanceData.set(null);            
         }
     }
 

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/impl/PortletPortalManager.java
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/impl/PortletPortalManager.java?rev=326102&r1=326101&r2=326102&view=diff
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/impl/PortletPortalManager.java
(original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/impl/PortletPortalManager.java
Tue Oct 18 06:29:15 2005
@@ -31,8 +31,6 @@
 	extends PortalManagerImpl
 	implements Initializable {
 
-    public static ThreadLocal copletInstanceData;
-
     /**
      * @see org.apache.avalon.framework.activity.Initializable#initialize()
      */
@@ -40,7 +38,6 @@
         Deprecation.logger.info("The PortletPortalManager is deprecated. Please use the PortletPortalManagerAspect
instead.");
         PortletAdapter aspect = (PortletAdapter)this.adapterSelector.select("portlet");
         this.chain.addAsFirst(aspect, new Parameters());
-        copletInstanceData = aspect.copletInstanceData;
     }
 }
 

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/util/ReferenceFieldHandler.java
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/util/ReferenceFieldHandler.java?rev=326102&r1=326101&r2=326102&view=diff
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/util/ReferenceFieldHandler.java
(original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/util/ReferenceFieldHandler.java
Tue Oct 18 06:29:15 2005
@@ -15,7 +15,7 @@
  */
 package org.apache.cocoon.portal.util;
 
-import java.util.HashMap;
+import java.util.Collections;
 import java.util.Map;
 
 /**
@@ -23,25 +23,22 @@
  *
  * @author <a href="mailto:bluetkemeier@s-und-n.de">Bj&ouml;rn L&uuml;tkemeier</a>
  * 
- * @version CVS $Id: ReferenceFieldHandler.java,v 1.5 2004/03/05 13:02:17 bdelacretaz Exp
$
+ * @version CVS $Id$
  */
 public abstract class ReferenceFieldHandler extends AbstractFieldHandler {
     /**
      * Used to pass resolvable objects to the field handler.
      */
-    private static ThreadLocal threadLocalMap = new InheritableThreadLocal();
+    private static ThreadLocal threadLocalMap = new ThreadLocal();
 
     /**
      * Gets the map used to pass resolvable objects to the field handler.
      */
     public static Map getObjectMap() {
         Map map = (Map) threadLocalMap.get();
-
         if (map == null) {
-            map = new HashMap();
-            threadLocalMap.set(map);
+            map = Collections.EMPTY_MAP;
         }
-
         return map;
     }
 
@@ -49,10 +46,10 @@
      * Sets the map used to pass resolvable objects to the field handler.
      */
     public static void setObjectMap(Map objectMap) {
-        if (objectMap == null) {
-            threadLocalMap.set(new HashMap());
-        } else {
-            threadLocalMap.set(objectMap);
-        }
+        threadLocalMap.set(objectMap);
+    }
+
+    public static void clearObjectMap() {
+        threadLocalMap.set(null);
     }
 }

Modified: cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/wsrp/adapter/WSRPAdapter.java
URL: http://svn.apache.org/viewcvs/cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/wsrp/adapter/WSRPAdapter.java?rev=326102&r1=326101&r2=326102&view=diff
==============================================================================
--- cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/wsrp/adapter/WSRPAdapter.java
(original)
+++ cocoon/branches/BRANCH_2_1_X/src/blocks/portal/java/org/apache/cocoon/portal/wsrp/adapter/WSRPAdapter.java
Tue Oct 18 06:29:15 2005
@@ -166,7 +166,7 @@
     protected ConsumerEnvironmentImpl consumerEnvironment;
     
     /** Stores the current coplet instance data per thread. */
-    protected final ThreadLocal copletInstanceData = new InheritableThreadLocal();
+    protected final ThreadLocal copletInstanceData = new ThreadLocal();
 
     /** The servlet configuration. */
     protected ServletConfig servletConfig;



Mime
View raw message