This is an automated email from the ASF dual-hosted git repository.
markt pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-daemon.git
The following commit(s) were added to refs/heads/master by this push:
new 713db7f Fix DAEMON-388. Show meaningful name in jconsole when using
jsvc.
713db7f is described below
commit 713db7f38051cd2c7320e7aa29e40848ba0b9ab4
Author: Mark Thomas <[email protected]>
AuthorDate: Fri May 3 13:42:50 2019 +0100
Fix DAEMON-388. Show meaningful name in jconsole when using jsvc.
---
src/changes/changes.xml | 6 +++++-
src/native/unix/native/java.c | 13 ++++++++++++-
2 files changed, 17 insertions(+), 2 deletions(-)
diff --git a/src/changes/changes.xml b/src/changes/changes.xml
index 7ea06f9..060c560 100644
--- a/src/changes/changes.xml
+++ b/src/changes/changes.xml
@@ -53,7 +53,11 @@
Procrun. prunsrv stopping with error due to hard-coded timeout.
</action>
<action issue="DAEMON-385" type="fix" dev="markt">
- Update config.guess and config.sub.
+ Update config.guess and config.sub.
+ </action>
+ <action issue="DAEMON-388" type="fix" dev="markt">
+ Jsvc. Set the sun.java.command system property when starting via jsvc
so
+ that tools like jconsole show something meaningful for the process
name.
</action>
<action issue="DAEMON-391" type="fix" dev="markt" due-to="Thorsten
Schöning">
Procrun. Correct the level name used in the GUI for WARN so that
changes
diff --git a/src/native/unix/native/java.c b/src/native/unix/native/java.c
index dfb5477..92033f7 100644
--- a/src/native/unix/native/java.c
+++ b/src/native/unix/native/java.c
@@ -231,7 +231,7 @@ bool java_init(arg_data *args, home_data *data)
}
#endif
arg.ignoreUnrecognized = FALSE;
- arg.nOptions = args->onum + 4; /* pid, ppid and abort */
+ arg.nOptions = args->onum + 5; /* pid, ppid, version, class and abort */
opt = (JavaVMOption *) malloc(arg.nOptions * sizeof(JavaVMOption));
for (x = 0; x < args->onum; x++) {
opt[x].optionString = strdup(args->opts[x]);
@@ -244,19 +244,30 @@ bool java_init(arg_data *args, home_data *data)
opt[x].optionString = strdup(daemonprocid);
jsvc_xlate_to_ascii(opt[x].optionString);
opt[x++].extraInfo = NULL;
+
snprintf(daemonprocid, sizeof(daemonprocid),
"-Dcommons.daemon.process.parent=%d", (int)getppid());
opt[x].optionString = strdup(daemonprocid);
jsvc_xlate_to_ascii(opt[x].optionString);
opt[x++].extraInfo = NULL;
+
snprintf(daemonprocid, sizeof(daemonprocid),
"-Dcommons.daemon.version=%s", JSVC_VERSION_STRING);
opt[x].optionString = strdup(daemonprocid);
jsvc_xlate_to_ascii(opt[x].optionString);
opt[x++].extraInfo = NULL;
+
+ /* DBCP-388. For the benefit of jconsole. */
+ snprintf(daemonprocid, sizeof(daemonprocid),
+ "-Dsun.java.command=%s", args->clas);
+ opt[x].optionString = strdup(daemonprocid);
+ jsvc_xlate_to_ascii(opt[x].optionString);
+ opt[x++].extraInfo = NULL;
+
opt[x].optionString = strdup("abort");
jsvc_xlate_to_ascii(opt[x].optionString);
opt[x].extraInfo = (void *)java_abort123;
+
arg.options = opt;
/* Do some debugging */