portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tay...@apache.org
Subject svn commit: r619697 - in /portals/jetspeed-2/branches/JETSPEED-2.1.2-POSTRELEASE/components: portal/src/java/org/apache/jetspeed/request/ registry/src/java/org/apache/jetspeed/components/portletentity/
Date Fri, 08 Feb 2008 00:20:22 GMT
Author: taylor
Date: Thu Feb  7 16:20:17 2008
New Revision: 619697

URL: http://svn.apache.org/viewvc?rev=619697&view=rev
Log:
https://issues.apache.org/jira/browse/JS2-852
Release content buffers after rendering

Modified:
    portals/jetspeed-2/branches/JETSPEED-2.1.2-POSTRELEASE/components/portal/src/java/org/apache/jetspeed/request/JetspeedRequestContextComponent.java
    portals/jetspeed-2/branches/JETSPEED-2.1.2-POSTRELEASE/components/registry/src/java/org/apache/jetspeed/components/portletentity/PortletEntityImpl.java

Modified: portals/jetspeed-2/branches/JETSPEED-2.1.2-POSTRELEASE/components/portal/src/java/org/apache/jetspeed/request/JetspeedRequestContextComponent.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/branches/JETSPEED-2.1.2-POSTRELEASE/components/portal/src/java/org/apache/jetspeed/request/JetspeedRequestContextComponent.java?rev=619697&r1=619696&r2=619697&view=diff
==============================================================================
--- portals/jetspeed-2/branches/JETSPEED-2.1.2-POSTRELEASE/components/portal/src/java/org/apache/jetspeed/request/JetspeedRequestContextComponent.java
(original)
+++ portals/jetspeed-2/branches/JETSPEED-2.1.2-POSTRELEASE/components/portal/src/java/org/apache/jetspeed/request/JetspeedRequestContextComponent.java
Thu Feb  7 16:20:17 2008
@@ -141,16 +141,6 @@
         {
             rc = (RequestContext) tlRequestContext.get();        
         }
-
-        if(rc != null)
-        {
-            return rc;
-        }
-        else
-        {
-            log.error("Cannot call getRequestContext() before it has been created and set
for this thread.");
-            throw new IllegalStateException("Cannot call getRequestContext() before it has
been created and set for this thread.");
-        }
+        return rc;        
     }
-
 }

Modified: portals/jetspeed-2/branches/JETSPEED-2.1.2-POSTRELEASE/components/registry/src/java/org/apache/jetspeed/components/portletentity/PortletEntityImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/branches/JETSPEED-2.1.2-POSTRELEASE/components/registry/src/java/org/apache/jetspeed/components/portletentity/PortletEntityImpl.java?rev=619697&r1=619696&r2=619697&view=diff
==============================================================================
--- portals/jetspeed-2/branches/JETSPEED-2.1.2-POSTRELEASE/components/registry/src/java/org/apache/jetspeed/components/portletentity/PortletEntityImpl.java
(original)
+++ portals/jetspeed-2/branches/JETSPEED-2.1.2-POSTRELEASE/components/registry/src/java/org/apache/jetspeed/components/portletentity/PortletEntityImpl.java
Thu Feb  7 16:20:17 2008
@@ -77,7 +77,6 @@
     protected String appName;
     private boolean dirty = false;
     private Fragment fragment;
-    private ThreadLocal fragmentPortletDefinition = new ThreadLocal();
     
     protected transient int timeoutCount = 0;
     protected transient long expiration = 0;
@@ -226,11 +225,21 @@
         }        
         
         // Wrap the portlet defintion every request thread
-        PortletDefinition fpd = (PortletDefinition)fragmentPortletDefinition.get();
+        // JS2-852: don't use thread local
+        RequestContext rc = rcc.getRequestContext();
+        String entityFragmentKey = getEntityFragmentKey();
+        PortletDefinition fpd = null;
+        if (rc != null)
+        {
+            fpd= (PortletDefinition)rc.getAttribute(entityFragmentKey);
+        }
         if (fpd == null)
         {
             fpd = new FragmentPortletDefinition(this.portletDefinition, fragment);
-            fragmentPortletDefinition.set(fpd);
+            if (rc != null)
+            {
+                rc.setAttribute(entityFragmentKey, fpd);
+            }
         }        
         return fpd;
     }
@@ -389,7 +398,11 @@
         {
             portletDefinition = (PortletDefinitionComposite) composite;
             // if the portletDefinition is modified, clear threadlocal fragmentPortletDefinition
cache
-            fragmentPortletDefinition.set(null);
+            RequestContext rc = rcc.getRequestContext();
+            if (rc != null)
+            {
+                rc.getRequest().removeAttribute(getEntityFragmentKey());
+            }
             this.appName = ((MutablePortletApplication)portletDefinition.getPortletApplicationDefinition()).getName();
             this.portletName = portletDefinition.getName();
         }
@@ -554,7 +567,11 @@
     {
         this.fragment = fragment;
         // if the fragment is set, clear threadlocal fragmentPortletDefinition cache
-        fragmentPortletDefinition.set(null);
+        RequestContext rc = rcc.getRequestContext();
+        if (rc != null)
+        {
+            rc.getRequest().removeAttribute(getEntityFragmentKey());
+        }
     }
 
     public int getRenderTimeoutCount()
@@ -587,4 +604,9 @@
         this.timeoutCount = timeoutCount;
     }
 
+    protected String getEntityFragmentKey()
+    {
+        String entityId = (this.getId() == null) ? "-unknown-entity" : this.getId().toString();
+        return "org.apache.jetspeed" + entityId ;
+    }
 }



---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-dev-help@portals.apache.org


Mime
View raw message