Summary
-------
Introduce the attach API command - `dumpheapext` to accept more arguments for jmap alike tools. This command is an extension of `dumpheap` command for argument processing and it is not exposed to user.
Problem
-------
The implementation of attach API used by jcmd tools like `jmap` has a limitation that the arguments number could not exceed 3.
To overcome this limitation, both jmap command and the JVM(attachListener) need to be modified to change the way that arguments are transported and parsed. (e.g. The jmap compose all arguments into a single string, and let JVM parse it to get every argument)
But this change could causes compatibility issue when new argument like "parallel=" was introduced to `jmap -dump` command, which makes `jmap -dump` have 4 arguments.
The issue is that old version of JVM could not parse the arguments from new version of jmap.
Solution
--------
To solve the issue, it is proposed to add an internal attach API command - `dumpheapext`, which first test whether there is new argument added (like `parallel=` for jmap dump):
If No, it calls dumpheap and works as before.
If Yes, it composes the whole argument as a string and pass it to JVM, and if JVM can not accept and thrown exception of "heapdumpext" is not recognized, it is an old version of JVM, and the jmap eats that exception and print error message like "unknow argument", which behaves like the old version of jmap.
Specification
------
No changes are required for specification. Because the proposed "dumpheapext" command is not exposed to user. And user should not be aware of it from any kind of output prompted by Jmap command.