Tuesday, October 27, 2009

ADF: Export Collection ActionListener issue

Status: work in progress
JDeveloper: 11.1.1.1.0
WebLogic: 10.3.1

Issue

Create simple Fusion Web Application as follows:

  1. Create readonly VO in the Business Layer on a table with > 20,000 records and expose it through an AM
  2. Create simple JSPX in the ViewController project
  3. Generate readonly table on a PanelCollection by drag and drop from the data control palette
  4. Create a command button with ExportCollectionActionListener (type="excelHTML" and exportId="<id of the table component>")
    Example:
    <af:panelCollection id="pc1">
    <f:facet name="menus"/>
    <f:facet name="toolbar">
    <af:toolbar id="t2" flex="1">
    <af:commandToolbarButton text="Test here: Excel Export"
    id="ctb1">
    <af:exportCollectionActionListener type="excelHTML"
    exportedId="t1"/>
    </af:commandToolbarButton>
    </af:toolbar>
    </f:facet>
    <f:facet name="statusbar"/>
    <af:table id="t1" ....
    </af:table>
    </af:panelCollection>

Now observe the memory consumption of the WLS

  1. Run the web application
  2. View the Memory consumtion of WLS process: ca 400MB
  3. Click the export to Excel button.
  4. View the Memory consumtion of WLS process: ca 740MB
  5. Undeploy the application
  6. View the Memory consumtion of WLS process: ca 740MB
Observations
  1. A single export of 20,000 records consumes ca. 340MB
  2. It seems there is a memory leak because the memory consumption remains after undeployment.
  3. Same result on Windows XP and Oracle Enterprise Linux 5.3(32bit)
Question

So why the export functionality consumes so much RAM?
Is there a memory leak? How to workaround?

Solution

Still in progress..in cooperation with Oracle Support… will be updated here.

Proposal

In order to be more flexible and powerful it would be great to be able to implement own Exporter implementations, e.g.

<af:exportCollectionActionListener type="excelHTML" exportedId="t1"
exporterClass="com.company.fusionapp.export.MyExcelExporter"/>

or even better (like custom conveter concept)

<af:exportCollectionActionListener type="excelHTML" exportedId="t1" exporterId="myExporter" />

and in adfc-config.xml:

<exporter id="myExporter" class="com.company.fusionapp.export.MyExcelExporter"/>