mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
Fix Usage failed to get pid (#4144)
* Update UsageManagerImpl.java When System.getProperty Failure to get the PID will cause the service to stay in the config phase. The startup cannot continue and there will be no log output Use managementfactory to get the PID and throw an exception when the PID cannot be obtained. * Update usage/src/main/java/com/cloud/usage/UsageManagerImpl.java Co-authored-by: dahn <daan.hoogland@gmail.com> * Update UsageManagerImpl.java * Update UsageManagerImpl.java * Update UsageManagerImpl.java Co-authored-by: dahn <daan.hoogland@gmail.com>
This commit is contained in:
parent
c1fb6b4cb9
commit
f66ae34ea7
@ -278,7 +278,14 @@ public class UsageManagerImpl extends ManagerBase implements UsageManager, Runna
|
|||||||
s_logger.error("Unhandled exception configuring UsageManger", e);
|
s_logger.error("Unhandled exception configuring UsageManger", e);
|
||||||
throw new ConfigurationException("Unhandled exception configuring UsageManager " + e.toString());
|
throw new ConfigurationException("Unhandled exception configuring UsageManager " + e.toString());
|
||||||
}
|
}
|
||||||
_pid = Integer.parseInt(System.getProperty("pid"));
|
|
||||||
|
try {
|
||||||
|
_pid = (int) ProcessHandle.current().pid();
|
||||||
|
} catch (Exception e) {
|
||||||
|
String msg = String.format("Unable to get process Id for %s!", e.toString());
|
||||||
|
s_logger.debug(msg);
|
||||||
|
throw new ConfigurationException(msg);
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user