Dear all, is the subject (BSF4ooRexx interacting with the interpreter) acceptable for this mailing list ?
Thank you for your consideration, Uli Zinngrebe ------------------------- Oorspronkelijk bericht ------------------------- Onderwerp: Resources held by interpreter not released when using BSF4ooRexx Van: [email protected] Datum: Ma, februari 28, 2011 14:35 Aan: [email protected] -------------------------------------------------------------------------- Dear all, When I run a Rexx script through BSF4ooRexx, it seems that streams that are opened in a script are not closed when the Rexx interpreter is finished executing the script. This code demonstrates the problem: import org.apache.bsf.*; public class BSFTestFileHandle { public static void main(final String[] args) throws Exception { BSFManager bm = new BSFManager(); testRunScript(bm); testRunScript(bm); } private static void testRunScript(final BSFManager bm) throws BSFException { System.out.print("The result of 'SAY LINES('TEST.TXT')' should be >0, but is "); BSFEngine engine = bm.loadScriptingEngine("rexx"); engine.exec("test.rexx", -1, -1, "SAY LINES('TEST.TXT')"); } } The test code runs 2 times a Rexx script that opens a file (assuming a non-empty file called 'TEXT.TXT' exists in the current directory). The first time it succeeds, the second time it fails. Expected output: The result of 'SAY LINES('TEST.TXT')' should be >0, but is 1 The result of 'SAY LINES('TEST.TXT')' should be >0, but is 1 Actual output: The result of 'SAY LINES('TEST.TXT')' should be >0, but is 1 The result of 'SAY LINES('TEST.TXT')' should be >0, but is 0 Running the same script from the command line works as expected (i.e. running the following twice on the command line prints '1' twice, as expected): rexx -E "SAY LINES('TEST.TXT')") I think there should be a way to have the interpreter shutting down and thus its held resources being released, either programmatically or for example in RexxEngine.terminate() and/or RexxEngine.exec() (after execution of the script). Best regards, Erik DuijsDear all,
When I run a Rexx script through BSF4ooRexx, it seems that streams that are opened in a script are not closed when the Rexx interpreter is finished executing the script.
This code demonstrates the problem:
import org.apache.bsf.*;
public class BSFTestFileHandle {
public static void main(final String[] args) throws Exception {
BSFManager bm = new BSFManager();
testRunScript(bm);
testRunScript(bm);
}
private static void testRunScript(final BSFManager bm) throws BSFException {
System.out.print("The result of 'SAY LINES('TEST.TXT')' should be >0, but is ");
BSFEngine engine = bm.loadScriptingEngine("rexx");
engine.exec("test.rexx", -1, -1, "SAY LINES('TEST.TXT')");
}
}
The test code runs 2 times a Rexx script that opens a file (assuming a non-empty file called 'TEXT.TXT' exists in the current directory).
The first time it succeeds, the second time it fails.
Expected output:
The result of 'SAY LINES('TEST.TXT')' should be >0, but is 1
The result of 'SAY LINES('TEST.TXT')' should be >0, but is 1
Actual output:
The result of 'SAY LINES('TEST.TXT')' should be >0, but is 1
The result of 'SAY LINES('TEST.TXT')' should be >0, but is 0
Running the same script from the command line works as expected (i.e. running the following twice on the command line prints '1' twice, as expected): rexx -E "SAY LINES('TEST.TXT')")
I think there should be a way to have the interpreter shutting down and thus its held resources being released, either programmatically or for example in RexxEngine.terminate() and/or RexxEngine.exec() (after execution of the script).
Best regards,
Erik Duijs
------------------------------------------------------------------------------ Free Software Download: Index, Search & Analyze Logs and other IT data in Real-Time with Splunk. Collect, index and harness all the fast moving IT data generated by your applications, servers and devices whether physical, virtual or in the cloud. Deliver compliance at lower cost and gain new business insights. http://p.sf.net/sfu/splunk-dev2dev
_______________________________________________ Oorexx-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/oorexx-devel
