Review request for 8016531: jconsole-plugin script demo does not work with nashorn

A. Sundararajan sundararajan.athijegannathan at oracle.com
Wed Aug 21 04:13:08 PDT 2013


The jconsole sample is most likely full java stack trace of all threads 
- and not the javascript trace.

-Sundar

On Wednesday 21 August 2013 04:21 PM, Marcelo Rodrigues Costa wrote:
> Hi guys,
>
> Just checking, on this section here:
>
> // print a stack every 1 second for 5 seconds
> load(src + "jstack.js");
> ..
>
> Is that a readable javascript stack trace or is it the same result we 
> get from jstack? I will try to run this to see what I get..
>
> Cheers!,
> --
> Marcelo R.
>
>
>
> 2013/8/4 Andreas Rieber <rieberandreas at gmail.com 
> <mailto:rieberandreas at gmail.com>>
>
>     Hi Sundar,
>
>     thanks that you had this issue still on your list. I checked it
>     again as it is already a few days old. There are some fixes
>     missing in
>     src/share/demo/scripting/jconsole-plugin/src/resources/jconsole.js
>
>     So i took your change, retested everything and added a few missing
>     lines, updated the readme + comments. The updated webrev is here:
>
>     http://cr.openjdk.java.net/~arieber/8016531/webrev.01/
>     <http://cr.openjdk.java.net/%7Earieber/8016531/webrev.01/>
>
>
>
>     On 02.08.13 16:55, A. Sundararajan wrote:
>
>         Please review http://cr.openjdk.java.net/~sundar/8016531/
>         <http://cr.openjdk.java.net/%7Esundar/8016531/>
>
>         This fix was contributed by Andreas Rieber ( arieber ).
>
>         I combined another one fix by Andreas for :
>
>               7023754 : Jconsole javascript plugin demo throws
>         exception on
>         window.print
>
>         as well as that fix is to make a class 'public' and the issue
>         is related
>         anyway.
>
>         Thanks
>         -Sundar
>
>
>     For those who want to test, i recorded the required steps here.
>
>     To start the jconsole plugin:
>
>     ./JDK_HOME/bin/jconsole -pluginpath
>     JDK_HOME/demo/scripting/jconsole-plugin/jconsole-plugin.jar
>
>     This will start jconsole and ask for a new connection. Just connect to
>     jconsole itself or any other process you might have running (i use a
>     tomcat). If it says: "Secure connection failed...", use the insecure
>     connection.
>
>     To test 7023754 click on the "Script Shell" tab (and one click in the
>     empty window to get the focus), then type: help() RETURN. You will see
>     a list of available functions.
>
>     To test the jconsole scripts with Nashorn, copy the following lines
>     into the jconsole "Script Shell" panel (update your jdk8tl path):
>
>     ----------------------------------------------------------------------
>
>     // set your jdk8tl path
>     var src =
>     "/usr/local/src/jdk8tl/jdk/src/share/demo/scripting/jconsole-plugin/src/scripts/";
>
>     // write a heapdump to /tmp
>     load(src + "heapdump.js");
>     heapdump("/tmp/heapdump");
>     print("heapdump done");
>
>     // prints "hello, world"
>     load(src + "hello.js");
>     print("hello done");
>
>     // reset the thread count
>     load(src + "invoke.js");
>     resetPeakThreadCount()
>     print("resetPeakThreadCount done");
>
>     // print a stack every 1 second for 5 seconds
>     load(src + "jstack.js");
>     var t = setInterval(function () { jstack(); }, 1000);
>     sleep(5000);
>     clearInterval(t);
>     print("jstack done");
>
>     // print jtop every 1 second for 5 seconds
>     load(src + "jtop.js");
>     var t = setInterval(function () { jtop(); }, 1000);
>     sleep(5000);
>     clearInterval(t);
>     print("jtop done");
>
>     // print sysprops every 1 seconds for 5 seconds
>     load(src + "sysprops.js");
>     var t = setInterval(function () { sysprops(); }, 1000);
>     sleep(5000);
>     clearInterval(t);
>     print("sysprops done");
>
>     // to see some GC logs on the shell where jconsole was started
>     load(src + "verbose.js");
>     verboseGC(true)
>     print("verboseGC done");
>     print("all done");
>
>     ----------------------------------------------------------------------
>
>     That was the easy part, now you can also run this scripts with
>     scriptpad via jrunscript. Here how it goes:
>
>     Start a demo with jmx remote port 1090 in a 2nd shell:
>
>     ./JDK_HOME/bin/java -Dcom.sun.management.jmxremote.port=1090
>     -Dcom.sun.management.jmxremote.ssl=false
>     -Dcom.sun.management.jmxremote.authenticate=false -jar
>     JDK_HOME/demo/jfc/Font2DTest/Font2DTest.jar
>
>     In your 1st shell go to the scriptpad samples:
>
>     cd JDK_HOME/sample/scripting/scriptpad/src/resources
>     ./JDK_HOME/bin/jrunscript -f Main.js -f -
>
>     In the menu use: "Tools->JMX Connect" and type "localhost:1090".
>     It should say "connected!".
>
>     Now copy the following lines and hit CTRL-R to run it (update your
>     jdk8tl path):
>
>     ----------------------------------------------------------------------
>
>     // set your jdk8tl path
>     var src =
>     "/usr/local/src/jdk8tl/jdk/src/share/demo/scripting/jconsole-plugin/src/scripts/";
>
>     // print a stack every 1 second for 5 seconds
>     load(src + "jstack.js");
>     var t = setInterval(function () { jstack(print); }, 1000);
>     sleep(5000);
>     clearInterval(t);
>
>     ----------------------------------------------------------------------
>
>     happy scripting
>     Andreas
>
>
>
>
> -- 
> Marcelo Rodrigues



More information about the nashorn-dev mailing list