MCPcopy Create free account
hub / github.com/apache/impala / JavaSetProcessName

Function JavaSetProcessName

be/src/common/init.cc:463–486  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

461}
462
463static Status JavaSetProcessName(const string& name) {
464 string current_val;
465 char* current_val_c = getenv("JAVA_TOOL_OPTIONS");
466 if (current_val_c != NULL) {
467 current_val = current_val_c;
468 }
469
470 if (!current_val.empty() && current_val.find("-Dsun.java.command") != string::npos) {
471 LOG(WARNING) << "Overriding sun.java.command in JAVA_TOOL_OPTIONS to " << name;
472 }
473
474 stringstream val_out;
475 if (!current_val.empty()) {
476 val_out << current_val << " ";
477 }
478 // Set sun.java.command so jps reports the name correctly, and ThreadNameAnnotator can
479 // use the process name for the main thread (and correctly restore the process name).
480 val_out << "-Dsun.java.command=" << name;
481
482 if (setenv("JAVA_TOOL_OPTIONS", val_out.str().c_str(), 1) < 0) {
483 return Status(Substitute("Could not update JAVA_TOOL_OPTIONS: $0", GetStrErrMsg()));
484 }
485 return Status::OK();
486}
487
488void impala::InitCommonRuntime(int argc, char** argv, bool init_jvm,
489 TestInfo::Mode test_mode, bool external_fe) {

Callers 1

InitCommonRuntimeMethod · 0.85

Calls 7

SubstituteFunction · 0.85
GetStrErrMsgFunction · 0.85
OKFunction · 0.85
StatusClass · 0.70
emptyMethod · 0.45
findMethod · 0.45
strMethod · 0.45

Tested by

no test coverage detected