java 9 objects api sample (#2413)

This commit is contained in:
Mohamed Sanaulla
2017-08-10 20:45:43 +03:00
committed by maibin
parent c3de3dbfa9
commit accb430f5e
2 changed files with 28 additions and 24 deletions

View File

@@ -6,7 +6,7 @@ public class ServiceMain {
public static void main(String[] args) throws InterruptedException {
ProcessHandle thisProcess = ProcessHandle.current();
long pid = thisProcess.getPid();
long pid = thisProcess.pid();
Optional<String[]> opArgs = Optional.ofNullable(args);
String procName = opArgs.map(str -> str.length > 0 ? str[0] : null).orElse(System.getProperty("sun.java.command"));