Hi Denghui,

I thought to add JMX client feature to jcmd in the past for similar purposes, 
but I didn't because JMX URL is too complex to type into console :)

Your proposal is useful, but it means malicious users can inject arbitrary 
code. I think we need to consider security, and existing framework like JMX 
might help us.


Thanks,

Yasumasa


On 2021/10/08 10:09, Denghui Dong wrote:
Hi Yasumasa,

JVMTI.data_dump and DataDumpRequest can achieve the purpose of triggering.

IIUC, DataDumpRequest does not seem to be able to pass parameters.
And sometimes the action the user wants to trigger may not be a data dump.

In fact, I think that commands such as JFR.start/stop are such a mechanism, 
triggered by `jcmd`, and finally callback to the java layer.

Denghui Dong

    ------------------------------------------------------------------
    From:Yasumasa Suenaga <suen...@oss.nttdata.com>
    Send Time:2021年10月8日(星期五) 07:45
    To:董登辉(卓昂) <denghui....@alibaba-inc.com>; serviceability-dev 
<serviceability-dev@openjdk.java.net>; hotspot-runtime-...@openjdk.java.net 
<hotspot-runtime-...@openjdk.java.net>
    Subject:Re: Extend jcmd to java application level

    Hi Denghui,


    I think you can do it with combination of JVMTI.data_dump dcmd and 
DataDumpRequest event in JVMTI.

    JVM(TM) Tool Interface 17.0.0 (oracle.com) 
<https://docs.oracle.com/en/java/javase/17/docs/specs/jvmti.html#DataDumpRequest>


    Thanks,

    Yasumasa


    On 2021/10/07 22:58, Denghui Dong wrote:

    Hi team,

    The `jcmd` command can be used to call some built-in diagnostic commands in 
vm.
    Can we consider extending it to the java layer like perf data, so that Java 
developers can
    customize their diagnostic commands and then call them through `jcmd`?

    One application scenario I can think of for this extension is that some 
statistical information
    may be collected in a java application. Triggering the output of this 
statistical information through
    the `jcmd` command seems to me relative to other mechanisms that trigger 
output (such as through
    an HTTP service, or periodic Printing) is more convenient.

    Any input is appreciated.

    Thanks,
    Denghui Dong


Reply via email to