Hi Gary,
On 12/04/2019 4:24 am, Gary Adams wrote:
Two years ago a request was made to allow
jcmd help
to be interpretted as a request for help from the current jcmd process
rather than requiring a separate target process to be involved.
Some attempts were made to close the issue, because the
command was not documented to work that way.
It was also pointed out that the help from the running jcmd
might not match the cmds available from a subsequent
request to a different process possibly running a different version
of the vm.
As proof of concept exercise this webrev shows a minimal set of
changes that could support
jcmd self help
Before fleshing out additional changes in documentation and testing,
I'd like to know if this is still a worth while enhancement. Also,
Given we allow a pid of 0 to mean all Java processes I can see scope for
a special value that means "the current Java process", but using a text
word like "self" seems awkward at best. Plus within a shell you can use:
jcmd $$ help
to act on the jcmd VM itself, so there doesn't need to be special
treatment in that sense. Perhaps some tweaks to the "jcmd -h" text.
I'd like to know more about the history of the checks preventing self
attach.
This may give you a start: https://bugs.openjdk.java.net/browse/JDK-8177154
Cheers,
David
Webrev: http://cr.openjdk.java.net/~gadams/8177064/webrev/index.html
Issue: https://bugs.openjdk.java.net/browse/JDK-8177064