Expand my Community achievements bar.

setProcessDataListValue causes Jboss to use 100% CPU

Avatar

Level 2

Hello everybody.

This is LCES 8.2.1 SP2 running on Windows 2003 server (turnkey).

Today I gave the executeScript a try but it seems the setProcessDataListValue causes Jboss to use 100% of the available CPU cycles and has to be stopped.

Here's the script I'm using:

=== cut here === 8<===

import java.util.List;
import java.util.Iterator;
import com.adobe.idp.Document;

List attachList = patExecContext.getProcessDataListValue("/process_data/doclist");
List newList = patExecContext.getProcessDataListValue("/process_data/doclisttask");

newList.clear();
Iterator it = attachList.iterator();

while(it.hasNext()) {
        Document attDoc = (Document) it.next();
        String name = (String) attDoc.getAttribute("name");
        attDoc.setAttribute("wsfilename",name);
        newList.add(attDoc);
}

attachList.clear();
patExecContext.setProcessDataListValue("/process_data/doclisttask",newList);

=== cut here === 8<===

In WorkBench, both doclist and doclisttask have Type=list and SubType=document.

By putting some System.out.println into the above script I've been able to verify that the process seems to hang while executing the patExecContext.setProcessDataListValue("/process_data/doclisttask",newList); before getting to the last line, I've been also able to check that "name" (String) is set correctly and that newList.add(attDoc) does return true (doclist has 2 document).

At this point, Jboss does consume all the available CPU and I have to manually stop it; I checked against Jboss log file but no error messages and or exceptions are reported.

What am I missing?

Thanks,

Rob

1 Reply

Avatar

Level 2

Problem solved.

It turned out that you do not need to "import" a LCES variable if you plan to initialize it into the script.

At the benefit of future posters/seekers, here's the script which works:

=== cut here === 8< ===

import java.util.List;
import java.util.Iterator;
import com.adobe.idp.Document;

List attachList = patExecContext.getProcessDataListValue("/process_data/doclist");

List newList = new ArrayList();

Iterator it = attachList.iterator();

while(it.hasNext()) {
        Document attDoc = (Document) it.next();
        String name = (String) attDoc.getAttribute("name");
        attDoc.setAttribute("wsfilename",name);
        if (newList.add((Document)attDoc) != true) {
                System.out.println("Error while inserting!");
        }
}

patExecContext.setProcessDataListValue("/process_data/doclisttask",newList);

=== cut here === 8< ===

Cheers,

Rob