cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cziege...@apache.org
Subject svn commit: r326104 - in /cocoon/blocks/portal/trunk/java/org/apache/cocoon: components/persistence/ portal/event/ portal/impl/ portal/tools/ portal/util/ portal/wsrp/adapter/
Date Tue, 18 Oct 2005 13:34:21 GMT
Author: cziegeler
Date: Tue Oct 18 06:34:13 2005
New Revision: 326104

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

Modified:
    cocoon/blocks/portal/trunk/java/org/apache/cocoon/components/persistence/CastorSourceConverter.java
    cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/event/Receiver.java
    cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/impl/AbstractComponent.java
    cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/tools/PortalToolManager.java
    cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/util/ReferenceFieldHandler.java
    cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/wsrp/adapter/WSRPAdapter.java

Modified: cocoon/blocks/portal/trunk/java/org/apache/cocoon/components/persistence/CastorSourceConverter.java
URL: http://svn.apache.org/viewcvs/cocoon/blocks/portal/trunk/java/org/apache/cocoon/components/persistence/CastorSourceConverter.java?rev=326104&r1=326103&r2=326104&view=diff
==============================================================================
--- cocoon/blocks/portal/trunk/java/org/apache/cocoon/components/persistence/CastorSourceConverter.java
(original)
+++ cocoon/blocks/portal/trunk/java/org/apache/cocoon/components/persistence/CastorSourceConverter.java
Tue Oct 18 06:34:13 2005
@@ -77,6 +77,8 @@
             return result;
         } catch (Exception e) {
             throw new ConverterException(e.getMessage(), e);
+        } finally {
+            ReferenceFieldHandler.clearObjectMap();
         }
     }
 

Modified: cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/event/Receiver.java
URL: http://svn.apache.org/viewcvs/cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/event/Receiver.java?rev=326104&r1=326103&r2=326104&view=diff
==============================================================================
--- cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/event/Receiver.java (original)
+++ cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/event/Receiver.java Tue Oct 18
06:34:13 2005
@@ -15,6 +15,8 @@
  */
 package org.apache.cocoon.portal.event;
 
+import org.apache.cocoon.components.Preloadable;
+
 /**
  * A receiver registers its interest in a class
  * of events through the {@link org.apache.cocoon.portal.event.EventManager}.
@@ -35,9 +37,12 @@
  * several inform methods each with the corresponding event class as the first
  * parameter.
  *
+ * This interface extends {@link org.apache.cocoon.components.Preloadable}
+ * as a receiver should subscribe itself as soon as the portal starts up.
+ *
  * @version $Id$
  */
-public interface Receiver {
+public interface Receiver extends Preloadable {
 
     // THIS IS JUST A MARKER INTERFACE!
 }

Modified: cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/impl/AbstractComponent.java
URL: http://svn.apache.org/viewcvs/cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/impl/AbstractComponent.java?rev=326104&r1=326103&r2=326104&view=diff
==============================================================================
--- cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/impl/AbstractComponent.java (original)
+++ cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/impl/AbstractComponent.java Tue
Oct 18 06:34:13 2005
@@ -25,7 +25,6 @@
 import org.apache.avalon.framework.service.ServiceManager;
 import org.apache.avalon.framework.service.Serviceable;
 import org.apache.avalon.framework.thread.ThreadSafe;
-import org.apache.cocoon.components.Preloadable;
 import org.apache.cocoon.portal.PortalService;
 import org.apache.cocoon.portal.event.Receiver;
 
@@ -42,7 +41,7 @@
  */
 public class AbstractComponent
     extends AbstractLogEnabled
-    implements Contextualizable, Serviceable, Disposable, ThreadSafe, Initializable, Preloadable
{
+    implements Contextualizable, Serviceable, Disposable, ThreadSafe, Initializable {
     
     // Implement Preloadable so that it automatically subscribes to events.
 

Modified: cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/tools/PortalToolManager.java
URL: http://svn.apache.org/viewcvs/cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/tools/PortalToolManager.java?rev=326104&r1=326103&r2=326104&view=diff
==============================================================================
--- cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/tools/PortalToolManager.java
(original)
+++ cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/tools/PortalToolManager.java
Tue Oct 18 06:34:13 2005
@@ -35,6 +35,7 @@
 import org.apache.avalon.framework.service.ServiceException;
 import org.apache.avalon.framework.service.ServiceManager;
 import org.apache.cocoon.ProcessingException;
+import org.apache.cocoon.components.Preloadable;
 import org.apache.cocoon.portal.PortalService;
 import org.apache.cocoon.portal.impl.AbstractComponent;
 import org.apache.cocoon.portal.tools.helper.PortalObjects;
@@ -52,7 +53,7 @@
  */
 public class PortalToolManager
     extends AbstractComponent
-    implements Parameterizable {
+    implements Parameterizable, Preloadable {
 
 	public static final String ROLE = PortalToolManager.class.getName();
 

Modified: cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/util/ReferenceFieldHandler.java
URL: http://svn.apache.org/viewcvs/cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/util/ReferenceFieldHandler.java?rev=326104&r1=326103&r2=326104&view=diff
==============================================================================
--- cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/util/ReferenceFieldHandler.java
(original)
+++ cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/util/ReferenceFieldHandler.java
Tue Oct 18 06:34:13 2005
@@ -15,7 +15,7 @@
  */
 package org.apache.cocoon.portal.util;
 
-import java.util.HashMap;
+import java.util.Collections;
 import java.util.Map;
 
 /**
@@ -24,22 +24,20 @@
  * @version $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;
     }
 
@@ -47,10 +45,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/blocks/portal/trunk/java/org/apache/cocoon/portal/wsrp/adapter/WSRPAdapter.java
URL: http://svn.apache.org/viewcvs/cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/wsrp/adapter/WSRPAdapter.java?rev=326104&r1=326103&r2=326104&view=diff
==============================================================================
--- cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/wsrp/adapter/WSRPAdapter.java
(original)
+++ cocoon/blocks/portal/trunk/java/org/apache/cocoon/portal/wsrp/adapter/WSRPAdapter.java
Tue Oct 18 06:34:13 2005
@@ -162,7 +162,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