I am currently using nashorn to run JavaScript in a java project. It is used to allow user scripting at some parts of my Java program.
I am aware of flag's like '--no-java' & '--no-syntax-extensions' to encapsulate the users JavaScript code. A few days ago I came across the option '-pcs'. It creates a Text file called 'NashornProfile.txt' in the execution directory. (See Nashorn profiler output format for more info)
Is there a way to directly get the information that is written to the file or is there a similar way to get this information? I DO NOT want to read the file that is created, as I will have multiple script instances running and all of them always output to this one exact text file.
I know that the file path is hard coded into the LinkerCallSite class. I am open to any better alternative to monitor the running script from code (especially global variables & some runtime characteristics).
I'm sorry if i overlooked something, but I am not too familiar with the scripting API.
Thanks in advance for any answers :)
There is a per-process customization of the file name. -Dnashorn.profilefile= can be given. But even then all nashorn activity in the same nashorn process will result that file being updated. i.e., there is no per -script or per-engine specific profile file.