You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jetspeed-dev@portals.apache.org by ta...@apache.org on 2008/02/08 01:21:08 UTC
svn commit: r619700 - in /portals/jetspeed-2/trunk/components:
jetspeed-portal/src/main/java/org/apache/jetspeed/request/
jetspeed-registry/src/main/java/org/apache/jetspeed/components/portletentity/
Author: taylor
Date: Thu Feb 7 16:21:05 2008
New Revision: 619700
URL: http://svn.apache.org/viewvc?rev=619700&view=rev
Log:
https://issues.apache.org/jira/browse/JS2-852
Release content buffers after rendering
Modified:
portals/jetspeed-2/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/request/JetspeedRequestContextComponent.java
portals/jetspeed-2/trunk/components/jetspeed-registry/src/main/java/org/apache/jetspeed/components/portletentity/PortletEntityImpl.java
Modified: portals/jetspeed-2/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/request/JetspeedRequestContextComponent.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/request/JetspeedRequestContextComponent.java?rev=619700&r1=619699&r2=619700&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/request/JetspeedRequestContextComponent.java (original)
+++ portals/jetspeed-2/trunk/components/jetspeed-portal/src/main/java/org/apache/jetspeed/request/JetspeedRequestContextComponent.java Thu Feb 7 16:21:05 2008
@@ -139,16 +139,7 @@
{
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/trunk/components/jetspeed-registry/src/main/java/org/apache/jetspeed/components/portletentity/PortletEntityImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/trunk/components/jetspeed-registry/src/main/java/org/apache/jetspeed/components/portletentity/PortletEntityImpl.java?rev=619700&r1=619699&r2=619700&view=diff
==============================================================================
--- portals/jetspeed-2/trunk/components/jetspeed-registry/src/main/java/org/apache/jetspeed/components/portletentity/PortletEntityImpl.java (original)
+++ portals/jetspeed-2/trunk/components/jetspeed-registry/src/main/java/org/apache/jetspeed/components/portletentity/PortletEntityImpl.java Thu Feb 7 16:21:05 2008
@@ -87,7 +87,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;
@@ -284,11 +283,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;
}
@@ -500,7 +509,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();
}
@@ -665,7 +678,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()
@@ -727,8 +744,14 @@
catch (Exception e)
{
}
- }
-
+ }
return editDefaultsMode;
}
+
+ 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