portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From woon...@apache.org
Subject svn commit: r590974 - /portals/jetspeed-2/branches/JETSPEED-2.1.3/components/portal/src/java/org/apache/jetspeed/aggregator/impl/WorkerMonitorImpl.java
Date Thu, 01 Nov 2007 12:24:35 GMT
Author: woonsan
Date: Thu Nov  1 05:24:35 2007
New Revision: 590974

URL: http://svn.apache.org/viewvc?rev=590974&view=rev
Log:
Fixed the following problem:

Problem: Sometimes, a page request does not get response in parallel rendering mode. Thread
dump shows that a thread is hanging on portletContent.wait() in AsyncPageAggregatorImpl. Also,
this happens only when a portlet fragment gets time-out.

Thread dump is like the following:
"http-8080-Processor24" daemon prio=6 tid=0x171e5c00 nid=0x4e0 in Object.wait() [0x1894e000..0x1894fd94]
   java.lang.Thread.State: WAITING (on object monitor)
	at java.lang.Object.wait(Native Method)
	- waiting on <0x02e60b40> (a org.apache.jetspeed.aggregator.impl.PortletContentImpl)
	at java.lang.Object.wait(Object.java:485)
	at org.apache.jetspeed.aggregator.impl.AsyncPageAggregatorImpl.aggregateAndRender(AsyncPageAggregatorImpl.java:236)
	- locked <0x02e60b40> (a org.apache.jetspeed.aggregator.impl.PortletContentImpl)
	<snip>

The old WorkerMonitorImpl has a while loop to interrupt worker and wait portlet content. But
this loop with ten times was meaningless. Because if it is notified at wait(), then the portlet
content is already completed.
By the way, the while loop in the old WorkerMonitorImpl caused this problem; sometimes this
can intercept all notifications from RenderingJobImpl's portletContent.notifyAll(); sometimes
AsyncPageAggregatorImpl cannot get notification when there's a timeout portlet fragment.
So, WorkerMonitorImpl was fixed to get notification once.

The old implementation's while loop seems designed to confirm interruption of a rendering
job, but the confirmation was not properly implemented. This kind of confirmation could be
revisited later. (What if a portlet catches InterruptedException and tries to proceed a long
job?)

Modified:
    portals/jetspeed-2/branches/JETSPEED-2.1.3/components/portal/src/java/org/apache/jetspeed/aggregator/impl/WorkerMonitorImpl.java

Modified: portals/jetspeed-2/branches/JETSPEED-2.1.3/components/portal/src/java/org/apache/jetspeed/aggregator/impl/WorkerMonitorImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/branches/JETSPEED-2.1.3/components/portal/src/java/org/apache/jetspeed/aggregator/impl/WorkerMonitorImpl.java?rev=590974&r1=590973&r2=590974&view=diff
==============================================================================
--- portals/jetspeed-2/branches/JETSPEED-2.1.3/components/portal/src/java/org/apache/jetspeed/aggregator/impl/WorkerMonitorImpl.java
(original)
+++ portals/jetspeed-2/branches/JETSPEED-2.1.3/components/portal/src/java/org/apache/jetspeed/aggregator/impl/WorkerMonitorImpl.java
Thu Nov  1 05:24:35 2007
@@ -365,20 +365,16 @@
                     log.warn("Portlet Rendering job to be interrupted by timeout (" + job.getTimeout()
+ "ms): " + windowId);
                 }
 
-                int waitCount = 0;
                 PortletContent content = job.getPortletContent();
-
-                while (!content.isComplete()) {
-                    if (++waitCount > 10) {
-                        break;
-                    }
-
-                    worker.interrupt();
-
-                    synchronized (content) {
+                
+                synchronized (content)
+                {
+                    if (!content.isComplete()) {
+                        worker.interrupt();
                         content.wait();
                     }
                 }
+                
             } catch (Exception e) {
                 log.error("Exceptiong during job killing.", e);
             }



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