if (!"hidden".equals(f.getState()))
{
if (child.getType().equals(ContentFragment.PORTLET))
{
// create and store the portlet rendering job into the jobs lists.
RenderingJob job = renderer.createRenderingJob(child, context);
// The returned job can be null for some reason, such as invalid portlet entity.
if (job != null)
{
if (job.getTimeout() > 0)
parallelJobs.add(job);
else
sequentialJobs.add(job);
}
}
else
{
// walk thru layout
// and store the layout rendering job into the layout jobs list.
aggregateAndRender(child, context, page, false, sequentialJobs, parallelJobs, layoutFragments);
layoutFragments.add(child);
}
}
}
}
// If the fragment is not root, skip the following.
if (!isRoot)
return;
int parallelJobCount = parallelJobs.size();
int sequentialJobCount = sequentialJobs.size();
if (log.isInfoEnabled())
{
log.info("Aggregating " + page.getPath() + ". Parallel: " + parallelJobCount + ", Sequential: " + sequentialJobCount);
}
CurrentWorkerContext.setParallelRenderingMode(parallelJobCount > 0);
// kick off the parallel rendering jobs
Iterator iter = parallelJobs.iterator();
while (iter.hasNext())
{
RenderingJob job = (RenderingJob) iter.next();
renderer.processRenderingJob(job);
}
// kick off the sequential rendering jobs
iter = sequentialJobs.iterator();
while (iter.hasNext())
{
RenderingJob job = (RenderingJob) iter.next();
renderer.processRenderingJob(job);
}
// synchronize on completion of all jobs
renderer.waitForRenderingJobs(parallelJobs);