With SP5 you now have the ability to thread the “preRender” lifecycle as well as or instead of the “render” lifecycle. If your portlets communicate with external systems during this lifecycle you might want to implement pre-render forking. Note that if you are using page flows, the initial begin actions and refresh actions run during the preRender phase.
The attribute forkPreRender enables forking (that is, multithreading) in the preRender lifecycle phase. Setting forkPreRender to true indicates that the portlet’s preRender phase should be forked. As with render phase forking, preRender phase forking is only possible if the portlet’s forkable attribute is set to true.
preRender forking is supported by these portlet types:
If you are threading portlets (that is, using forkable=true) ensure that you configure a portalRenderQueue and/or portalPreRenderQueue in your config.xml file so that the forked portlets use their own thread pools and not the WebLogic thread pool. The following code sample describes how to set the thread count appropriately:
<ExecuteQueue Name="default" ThreadCount="15"/>
<ExecuteQueue Name="portalRenderQueue" ThreadCount="5"/>
<ExecuteQueue Name="portalPreRenderQueue" ThreadCount="5"/>
At this time, forkPreRender is not supported by either the WebLogic Workshop interface or the WebLogic Portal Administration Portal. Instead, you need to implement it at the code level in the .portlet file. This topic describes how to enable the forkPreRender attribute for each portlet type.
To enable forkPreRender on a JSP portlet:
<?xml version="1.0" encoding="UTF-8"?> <portal:root xmlns:netuix="http://www.bea.com/servers/netuix/xsd/controls/netuix/1.0.0" xmlns:portal="http://www.bea.com/servers/netuix/xsd/portal/support/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.bea.com/servers/netuix/xsd/portal/support/1.0.0 portal-support-1_0_0.xsd"> <netuix:portlet backingFile="com.bea.backing.jspBacking" definitionLabel="portlet_2" forkPreRender="true" forkRender="true" forkRenderTimeout="20" forkPreRenderTimeout="20" forkable="true" title="jspPortlet"> <netuix:titlebar> <netuix:maximize/> <netuix:minimize/> </netuix:titlebar> <netuix:content> <netuix:jspContent contentUri="/portlets/jspPortlets/jspPortlet.jsp"/> </netuix:content> </netuix:portlet> </portal:root>
To enable forkPreRender on a Page Flow portlet:
<?xml version="1.0" encoding="UTF-8"?> <portal:root xmlns:netuix="http://www.bea.com/servers/netuix/xsd/controls/netuix/1.0.0" xmlns:portal="http://www.bea.com/servers/netuix/xsd/portal/support/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.bea.com/servers/netuix/xsd/portal/support/1.0.0 portal-support-1_0_0.xsd"> <netuix:portlet backingFile="com.bea.backing.pfBacking" definitionLabel="portlet_1" forkPreRender="true" forkRender="true" forkRenderTimeout="20" forkPreRenderTimeout="30" forkable="true" title="PfTest1Controller"> <netuix:titlebar> <netuix:maximize/> <netuix:minimize/> </netuix:titlebar> <netuix:content> <netuix:pageflowContent contentUri="/portlets/pfPortlets/pfTest1/pfTest1/PfTest1Controller.jpf"/> </netuix:content> </netuix:portlet> </portal:root>
To enable forkPreRender on a JSR168 portlet:
<?xml version="1.0" encoding="UTF-8"?> <portal:root xmlns:netuix="http://www.bea.com/servers/netuix/xsd/controls/netuix/1.0.0" xmlns:portal="http://www.bea.com/servers/netuix/xsd/portal/support/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.bea.com/servers/netuix/xsd/portal/support/1.0.0 portal-support-1_0_0.xsd"> <netuix:javaPortlet backingFile="com.bea.backing.javaBacking" definitionLabel="javaPortlet_1" forkPreRender="true" forkPreRenderTimeout="30" forkRender="false" forkRenderTimeout="20" forkable="true" title="Java Portlet"/> </portal:root>
To enable forkPreRender on a WSRP Consumer portlet:
<?xml version="1.0" encoding="UTF-8"?> <portal:root xmlns:netuix="http://www.bea.com/servers/netuix/xsd/controls/netuix/1.0.0" xmlns:portal="http://www.bea.com/servers/netuix/xsd/portal/support/1.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.bea.com/servers/netuix/xsd/portal/support/1.0.0 portal-support-1_0_0.xsd"> <netuix:proxyPortlet backingFile="com.bea.backing.wsrpConsumerBacking" cacheExpires="300" definitionLabel="portlet_1_1" description="" doesUrlTemplateProcessing="true" forkPreRender="true" forkPreRenderTimeout="20" forkRender="true" forkRenderTimeout="20" forkable="true" groupId="producerWA" portletHandle="portlet_1" producerHandle="wsrpProducer" renderCacheable="true" templatesStoredInSession="true" title="producerTest"> <netuix:titlebar> <netuix:maximize/> <netuix:minimize/> </netuix:titlebar> <netuix:proxyPortletContent/> </netuix:proxyPortlet> </portal:root>