| 461 | } |
| 462 | |
| 463 | static 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 | |
| 488 | void impala::InitCommonRuntime(int argc, char** argv, bool init_jvm, |
| 489 | TestInfo::Mode test_mode, bool external_fe) { |
no test coverage detected