openjdk/jdk/src/share/demo/scripting/jconsole-plugin/src/scripts/jstack.js
/**
 * print stack traces of all threads. 
 *
 * @param printFunc function called to print [optional]
 * @param maxFrames maximum number of frames to print [optional]
 */
print stack traces of all threads.
@param printFunc function called to print [optional]
@param maxFrames maximum number of frames to print [optional]
print stack traces of all threads . @param printFunc function called to print [ optional ] @param maxFrames maximum number of frames to print [ optional ]
function jstack(printFunc, maxFrames) {
    if (printFunc == undefined) {
        printFunc = echo;
    }
    if (maxFrames == undefined) {
        maxFrames = 25;
    }
    var tmbean = newPlatformMXBeanProxy(
        "java.lang:type=Threading",
        java.lang.management.ThreadMXBean);
    var tids = tmbean.allThreadIds;
    var tinfos = tmbean["getThreadInfo(long[],int)"](tids, maxFrames);
    for (var i in tinfos) {
        printThreadInfo(tinfos[i], printFunc);
    }
}
function jstack ( printFunc , maxFrames ) { if ( printFunc == undefined ) { printFunc = echo ; } if ( maxFrames == undefined ) { maxFrames = 25 ; } var tmbean = newPlatformMXBeanProxy ( "java.lang:type=Threading" , java . lang . management . ThreadMXBean ) ; var tids = tmbean . allThreadIds ; var tinfos = tmbean [ "getThreadInfo(long[],int)" ] ( tids , maxFrames ) ; for ( var i in tinfos ) { printThreadInfo ( tinfos [ i ] , printFunc ) ; } }
print stack traces of all threads.
print stack traces of all threads .
// by default use 'echo' to print. Other choices could be // 'print' or custom function that writes in a text file // by default print 25 frames