Issue #1509 garbage collect after each procedure run
Change-Id: I7792d8bc186d6cef0fea38eccb657af040746fd7 Former-commit-id:add161ae2f
[formerlybd9123fb3a
[formerly fa239d3e7413c7441ba4440f0fe10f9e373de3df]] Former-commit-id:bd9123fb3a
Former-commit-id:c5d725bc7e
This commit is contained in:
parent
8c8a94d567
commit
c625919a82
3 changed files with 22 additions and 0 deletions
|
@ -51,6 +51,8 @@ import com.raytheon.viz.gfe.smartscript.FieldDefinition;
|
|||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Nov 10, 2008 njensen Initial creation
|
||||
* Jan 18, 2013 njensen Added garbageCollect()
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
* @author njensen
|
||||
|
@ -354,4 +356,20 @@ public abstract class BaseGfePyController extends PythonScript implements
|
|||
execute("addModule", INTERFACE, argMap);
|
||||
}
|
||||
|
||||
/**
|
||||
* Runs the python garbage collector. This should be run at the end of a
|
||||
* procedure or tool in case the custom python used tk. If the python used
|
||||
* tk and it is not garbage collected, errors about invalid threads may
|
||||
* occur when the garbage collector runs in another python interpreter.
|
||||
*/
|
||||
public void garbageCollect() {
|
||||
try {
|
||||
jep.eval("import gc");
|
||||
jep.eval("gc.collect()");
|
||||
} catch (JepException e) {
|
||||
statusHandler.handle(Priority.PROBLEM,
|
||||
"Error garbage collecting GFE python interpreter", e);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -56,6 +56,7 @@ import com.raytheon.viz.gfe.jobs.AsyncProgressJob;
|
|||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Oct 8, 2009 njensen Initial creation
|
||||
* Jan 18, 2013 1509 njensen Garbage collect after running procedure
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -395,6 +396,7 @@ public class ProcedureJob extends AbstractQueueJob<ProcedureRequest> {
|
|||
statusHandler.handle(Priority.PROBLEM, "Error executing procedure "
|
||||
+ procedureName, e);
|
||||
} finally {
|
||||
controller.garbageCollect();
|
||||
progressJob.done(pjStatus);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -53,6 +53,7 @@ import com.raytheon.viz.gfe.smarttool.Tool;
|
|||
* Date Ticket# Engineer Description
|
||||
* ------------ ---------- ----------- --------------------------
|
||||
* Jan 19, 2010 njensen Initial creation
|
||||
* Jan 18, 2013 1509 njensen Garbage collect after running tool
|
||||
*
|
||||
* </pre>
|
||||
*
|
||||
|
@ -164,6 +165,7 @@ public class SmartToolJob extends AbstractQueueJob<SmartToolRequest> {
|
|||
"Error in smart tool", e);
|
||||
throw e;
|
||||
} finally {
|
||||
python.garbageCollect();
|
||||
progressJob.done(pjResult);
|
||||
req = request;
|
||||
request = null;
|
||||
|
|
Loading…
Add table
Reference in a new issue