Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8204595

Extend jcmd vm selection syntax to allow wildcards.

XMLWordPrintable

    • Icon: CSR CSR
    • Resolution: Withdrawn
    • Icon: P4 P4
    • None
    • hotspot
    • svc
    • behavioral
    • minimal
    • Hide
      There is a miniscule behavioral change: a command line which reads like this:

      `jcmd '*'`

      would beforehand just not worked and produced no results:

      ```
      /shared/projects/openjdk/jdk-jdk/output-fastdebug $ ./images/jdk/bin/jcmd '*'
      Could not find any processes matching : '*'
      ```

      With the proposed change, this would now work. But I consider that very theoretical and only mention it for completeness sake.
      Show
      There is a miniscule behavioral change: a command line which reads like this: `jcmd '*'` would beforehand just not worked and produced no results: ``` /shared/projects/openjdk/jdk-jdk/output-fastdebug $ ./images/jdk/bin/jcmd '*' Could not find any processes matching : '*' ``` With the proposed change, this would now work. But I consider that very theoretical and only mention it for completeness sake.
    • add/remove/modify command line option

      Summary

      Extend jcmd vm selection syntax to allow wildcards.

      Problem

      For jcmd, vmid resolution on the command line can feel a bit strange.

      One can give the program name (which is the name of the main class or the name of the jar file) instead of pid which is a very nice feature.

      One can also give it part of a program name to select multiple running VMs - e.g. as in

      jcmd com.test

      would select all processes running classes or jar files whose name contains "com.test".

      But there is no way to just select all processes on the machine. Nor is there a way to specify prefix or suffix matching. And finally, at least for me, the syntax is a bit surprising: I would have expected wildcards.

      So, to select all processes running on a box, I usually do this:

      jcmd .

      since the dot '.' usually occurs in almost any program name for any running VM. But that just feels wrong.

      Solution

      1) Extend the command line syntax of jcmd such that program names can be suffixed with '*':

      jcmd 'test.*'

      would select all processes whose program names start with "test.".

      2) Less important but complementing (1): Extend the command line syntax of jcmd such that program names can be prefixed with '*':

      jcmd '*Test.java'

      would select all processes whose program names end with "Test.java".

      3) Finally, a singular "*" should mean "select all processes"

      jcmd '*'

      • This addition to the syntax can be put atop the existing syntax:
      jcmd com.test

      should continue to work and be equivalent to

      jcmd '*com.test*'
      • This change would have to be completely done in the jcmd client and, of course, not require any change in the hotspot. So a new client with this new syntax should immediately work with all existing VMs.

      Specification

      No implementation yet.

            stuefe Thomas Stuefe
            stuefe Thomas Stuefe
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: