-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add new methods to get current process ID (pid) to KiwiEnvironment #640
Comments
* Add currentPid() and tryGetCurrentPid() to KiwiEnvironment * Add default implementations of these methods in DefaultEnvironment Closes #640
* Add currentPid() and tryGetCurrentPid() to KiwiEnvironment * Add default implementations of these methods in DefaultEnvironment Closes #640
Re-opening this to discuss whether the |
One really annoying thing is that the // assume pid is a Long
var desc = Optional.of(pid).map(String::valueOf).orElse("[unknown]"); But to do something similar if you have an // assume optLongPid is an OptionalLong
var desc = optLongPid.stream().mapToObj(String::valueOf).findFirst().orElse("[unknown]") I don't really understand why the JDK designers chose not to add The only use case I've found where this matters at all is the above one, in which we want to log the pid or a String indicating it is unknown. And the only reason that is necessary is that the JDK's Overall, I think it makes the most sense to change it to |
Replace the existing
currentProcessId
andtryGetCurrentProcessId
methods with the following:long currentPid()
Optional<Long> tryGetCurrentPid()
These should use
ProcessHandle.current().pid()
internally.The old methods will be deprecated by #639
The text was updated successfully, but these errors were encountered: