Hi,
I've been using my workflow process without problems so far but did some modifications
to execute a node (which calls a bash script) in a loop until some conditions are
asserted. The main source code of the node's ActionHandler class is this:
| Iterator<String> it =
(Iterator<String>)sitesList.iterator();
|
| LogRedirectThread lgError = null;
| LogRedirectThread lgOutput = null;
|
| while(it.hasNext()) {
| String newSite = (String)it.next();
|
| Process proc = rt.exec(pathToCrawl + " " + newSite + " "
+ pathToData + "/crawl-data/" + topic + " " +
(String)contextInstance.getVariable("path") + " " + typeOfSources
+" " + depth );
|
| lgError = new LogRedirectThread(proc.getErrorStream(),pathToData +
"/logs/" + topic + "/crawler_sites_stderr_cycle" + cycleID +
".log");
| lgOutput = new LogRedirectThread(proc.getInputStream(),pathToData +
"/logs/" + topic + "/crawler_sites_stdout_cycle" + cycleID +
".log");
|
| lgError.start();
| lgOutput.start();
|
| int exitVal = proc.waitFor();
|
| sitesList.remove(newSite);
|
| if (exitVal != 0) {
| throw new CrawlerException(newSite);
|
| }
|
| }
|
that is, just call the script through the Runtime.exec() interface and creates two threads
to read the stdout and stderr standard outputs.
The problem is that I'm getting a heap OutOfMemory error when the node is executed
more than 5 times (btw, my JAVA_OPTS is -Xmx1500m so that should be ok). My question
are:
How do jBPM and particularly the ActionHandler's invoker manage memory? and
Do I need to release manually the resources created inside the ActionHandler::execute
method, in my case the threads?
Other useful information: some objects are also injected In my ActionHandler class from
Spring framework. The OutOfMemory exception is thrown when, in a new cycle, the class is
trying to get those beans from the spring context.
Thanks
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4150661#...
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&a...