portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From woon...@apache.org
Subject svn commit: r592237 - in /portals/jetspeed-2/branches/JETSPEED-2.1.3: components/portal/src/java/org/apache/jetspeed/aggregator/impl/ src/webapp/WEB-INF/assembly/
Date Tue, 06 Nov 2007 03:22:44 GMT
Author: woonsan
Date: Mon Nov  5 19:22:43 2007
New Revision: 592237

URL: http://svn.apache.org/viewvc?rev=592237&view=rev
Log:
[JS2-785] Parallel Rendering on Websphere 6.1
Fixed the the problem when commonj work manager was used to render portlets.

java.util.ConcurrentModificationException
  at java.util.HashMap$HashIterator.nextEntry(HashMap.java:842)
  at java.util.HashMap$KeyIterator.next(HashMap.java:878)
  at org.apache.jetspeed.aggregator.impl.RenderingJobImpl.execute(RenderingJobImpl.java:216)
  at org.apache.jetspeed.aggregator.impl.RenderingJobImpl.run(RenderingJobImpl.java:179)
  at org.apache.jetspeed.aggregator.impl.CommonjWorkerMonitorImpl$RenderingJobCommonjWork.run(CommonjWorkerMonitorImpl.java:279)
  at com.ibm.ws.asynchbeans.J2EEContext.run(J2EEContext.java:1112)
  at com.ibm.ws.asynchbeans.WorkWithExecutionContextImpl.go(WorkWithExecutionContextImpl.java:195)
  at com.ibm.ws.asynchbeans.CJWorkItemImpl.run(CJWorkItemImpl.java:187)
  at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1469)

Before we have CommonjWorkerMonitorImpl, we just put some objects into a map to be passed
into a
rendering job object.
However, now we put some objects into the map and get some from the map because we need keep
workItem object and thread object.

So, the map object need to be a synchronized map for this case.

Modified:
    portals/jetspeed-2/branches/JETSPEED-2.1.3/components/portal/src/java/org/apache/jetspeed/aggregator/impl/CommonjWorkerMonitorImpl.java
    portals/jetspeed-2/branches/JETSPEED-2.1.3/components/portal/src/java/org/apache/jetspeed/aggregator/impl/PortletRendererImpl.java
    portals/jetspeed-2/branches/JETSPEED-2.1.3/components/portal/src/java/org/apache/jetspeed/aggregator/impl/RenderingJobImpl.java
    portals/jetspeed-2/branches/JETSPEED-2.1.3/src/webapp/WEB-INF/assembly/aggregation.xml

Modified: portals/jetspeed-2/branches/JETSPEED-2.1.3/components/portal/src/java/org/apache/jetspeed/aggregator/impl/CommonjWorkerMonitorImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/branches/JETSPEED-2.1.3/components/portal/src/java/org/apache/jetspeed/aggregator/impl/CommonjWorkerMonitorImpl.java?rev=592237&r1=592236&r2=592237&view=diff
==============================================================================
--- portals/jetspeed-2/branches/JETSPEED-2.1.3/components/portal/src/java/org/apache/jetspeed/aggregator/impl/CommonjWorkerMonitorImpl.java
(original)
+++ portals/jetspeed-2/branches/JETSPEED-2.1.3/components/portal/src/java/org/apache/jetspeed/aggregator/impl/CommonjWorkerMonitorImpl.java
Mon Nov  5 19:22:43 2007
@@ -26,6 +26,7 @@
 import java.util.Collections;
 import java.util.Map;
 import java.util.HashMap;
+import java.util.Arrays;
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
@@ -416,7 +417,7 @@
                 try 
                 {
                     List timeoutJobWorks = new ArrayList();
-                    Collection jobWorks = jobWorksMonitored.values();
+                    Collection jobWorks = Arrays.asList(jobWorksMonitored.values().toArray());
                     
                     for (Iterator it = jobWorks.iterator(); it.hasNext(); )
                     {

Modified: portals/jetspeed-2/branches/JETSPEED-2.1.3/components/portal/src/java/org/apache/jetspeed/aggregator/impl/PortletRendererImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/branches/JETSPEED-2.1.3/components/portal/src/java/org/apache/jetspeed/aggregator/impl/PortletRendererImpl.java?rev=592237&r1=592236&r2=592237&view=diff
==============================================================================
--- portals/jetspeed-2/branches/JETSPEED-2.1.3/components/portal/src/java/org/apache/jetspeed/aggregator/impl/PortletRendererImpl.java
(original)
+++ portals/jetspeed-2/branches/JETSPEED-2.1.3/components/portal/src/java/org/apache/jetspeed/aggregator/impl/PortletRendererImpl.java
Mon Nov  5 19:22:43 2007
@@ -21,6 +21,7 @@
 import java.util.Iterator;
 import java.util.Map;
 import java.util.List;
+import java.util.Collections;
 
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
@@ -499,7 +500,7 @@
         // In case of parallel mode, store attributes in a map to be refered by worker.
         if (isParallel)
         {
-            Map workerAttrs = new HashMap();
+            Map workerAttrs = Collections.synchronizedMap(new HashMap());
             workerAttrs.put(PortalReservedParameters.PAGE_ATTRIBUTE, requestContext.getPage());
             workerAttrs.put(PortalReservedParameters.FRAGMENT_ATTRIBUTE, fragment);
             workerAttrs.put(PortalReservedParameters.CONTENT_DISPATCHER_ATTRIBUTE, dispatcher);

Modified: portals/jetspeed-2/branches/JETSPEED-2.1.3/components/portal/src/java/org/apache/jetspeed/aggregator/impl/RenderingJobImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/branches/JETSPEED-2.1.3/components/portal/src/java/org/apache/jetspeed/aggregator/impl/RenderingJobImpl.java?rev=592237&r1=592236&r2=592237&view=diff
==============================================================================
--- portals/jetspeed-2/branches/JETSPEED-2.1.3/components/portal/src/java/org/apache/jetspeed/aggregator/impl/RenderingJobImpl.java
(original)
+++ portals/jetspeed-2/branches/JETSPEED-2.1.3/components/portal/src/java/org/apache/jetspeed/aggregator/impl/RenderingJobImpl.java
Mon Nov  5 19:22:43 2007
@@ -20,6 +20,9 @@
 import java.util.Iterator;
 import java.util.Map;
 import java.util.HashMap;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Arrays;
 
 import javax.portlet.UnavailableException;
 import javax.servlet.ServletRequest;
@@ -210,7 +213,9 @@
                 isParallelMode = CurrentWorkerContext.getParallelRenderingMode();
                 if (isParallelMode)
                 {
-                    Iterator itAttrNames = this.workerAttributes.keySet().iterator();
+                    Collection attrNames = Arrays.asList(this.workerAttributes.keySet().toArray());
+                    
+                    Iterator itAttrNames = attrNames.iterator();
                     while (itAttrNames.hasNext()) 
                     {
                         String name = (String) itAttrNames.next();
@@ -396,7 +401,7 @@
     {
         if (this.workerAttributes == null)
         {
-            this.workerAttributes = new HashMap();
+            this.workerAttributes = Collections.synchronizedMap(new HashMap());
         }
         
         if (value != null)

Modified: portals/jetspeed-2/branches/JETSPEED-2.1.3/src/webapp/WEB-INF/assembly/aggregation.xml
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/branches/JETSPEED-2.1.3/src/webapp/WEB-INF/assembly/aggregation.xml?rev=592237&r1=592236&r2=592237&view=diff
==============================================================================
--- portals/jetspeed-2/branches/JETSPEED-2.1.3/src/webapp/WEB-INF/assembly/aggregation.xml
(original)
+++ portals/jetspeed-2/branches/JETSPEED-2.1.3/src/webapp/WEB-INF/assembly/aggregation.xml
Mon Nov  5 19:22:43 2007
@@ -163,6 +163,14 @@
     
     If you want to use Commonj Work Manager provided by the container, uncomment the followings
     and replace 'org.apache.jetspeed.aggregator.WorkerMonitor' with 'org.apache.jetspeed.aggregator.CommonjWorkerMonitor'
in this file.
+    
+    For the bean named 'org.apache.jetspeed.aggregator.CommonjWorkerMonitor', two flags can
be added as constructor-args.
+    The second constructor-arg is a flag whether a separate timeout-monitor thread is used
or not as the old WorkerMonitorImpl does.
+    By default, this flag is set to true. If it is set to false, then a new commonj work
will be created for timeout-monitoring per page request.
+    The third constructor-arg is a flag whether the commonj timeout-monitor work should try
to interrupt a timeout worker thread.
+    This flag is meaningful only when the second constructor-arg is set to false, and by
default this flag is set to true. 
+    If it is set to false, then it does not wait for the timeout rendering works without
interruption.
+    On most platforms such as WebSphere or WebLogic, the default flag options (true, true)
will be fine.
     -->
     
     <!--



---------------------------------------------------------------------
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