/** *Helperclassforhandlingjpsarguments
*/ publicenum JpsArg {
q,
l,
m,
v,
V;
/** *Generateallpossiblecombinationsof{@linkJpsArg} *(31argumentcombinationsandnoargumentscase)
*/ publicstatic List<List<JpsArg>> generateCombinations() { finalint argCount = JpsArg.values().length; // If there are more than 30 args this algorithm will overflow.
Asserts.assertLessThan(argCount, 31, "Too many args");
List<List<JpsArg>> combinations = new ArrayList<>(); int combinationCount = (int) Math.pow(2, argCount); for (int currCombo = 0; currCombo < combinationCount; ++currCombo) {
List<JpsArg> combination = new ArrayList<>(); for (int position = 0; position < argCount; ++position) { int bit = 1 << position; if ((bit & currCombo) != 0) {
combination.add(JpsArg.values()[position]);
}
}
combinations.add(combination);
} return combinations;
}
/** *Returncombinationof{@linkJpsArg}asaStringarray
*/ publicstatic String[] asCmdArray(List<JpsArg> jpsArgs) {
List<String> list = new ArrayList<>(); for (JpsArg jpsArg : jpsArgs) {
list.add("-" + jpsArg.toString());
} return list.toArray(new String[list.size()]);
}
boolean isQuiet = false; boolean isFull = false;
String pattern; for (JpsHelper.JpsArg jpsArg : combination) { switch (jpsArg) { case q: // If '-q' is specified output should contain only a list of local VM identifiers: // 30673
isQuiet = true;
JpsHelper.verifyJpsOutput(output, "^\\d+$");
output.shouldContain(Long.toString(pid)); break; case l: // If '-l' is specified output should contain the full package name for the application's main class // or the full path name to the application's JAR file: // 30673 /tmp/jtreg/jtreg-workdir/scratch/LingeredAppForJps.jar ...
isFull = true;
pattern = "^" + pid + "\\s+" + replaceSpecialChars(fullProcessName) + ".*";
output.shouldMatch(pattern); break; case m: // If '-m' is specified output should contain the arguments passed to the main method: // 30673 LingeredAppForJps lockfilename ...
pattern = "^" + pid + ".*" + replaceSpecialChars(argument) + ".*";
output.shouldMatch(pattern); break; case v: // If '-v' is specified output should contain VM arguments: // 30673 LingeredAppForJps -Xmx512m -XX:+UseParallelGC -XX:Flags=/tmp/jtreg/jtreg-workdir/scratch/vmflags ... for (String vmArg : JpsHelper.getVmArgs()) {
pattern = "^" + pid + ".*" + replaceSpecialChars(vmArg) + ".*";
output.shouldMatch(pattern);
} break; case V: // If '-V' is specified output should contain VM flags: // 30673 LingeredAppForJps +DisableExplicitGC ...
pattern = "^" + pid + ".*" + replaceSpecialChars(JpsHelper.VM_FLAG) + ".*";
output.shouldMatch(pattern); break;
}
if (isQuiet) { break;
}
}
if (!isQuiet) { // Verify output line by line. // Output should only contain lines with pids after the first line with pid.
JpsHelper.verifyJpsOutput(output, "^\\d+\\s+.*"); if (!isFull) {
pattern = "^" + pid + "\\s+" + replaceSpecialChars(processName); if (combination.isEmpty()) { // If no arguments are specified output should only contain // pid and process name
pattern += "$";
} else {
pattern += ".*";
}
output.shouldMatch(pattern);
}
}
}
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.