io.smallrye.common.os.GetAllProcessesInfoAction Maven / Gradle / Ivy
The newest version!
package io.smallrye.common.os;
import java.security.PrivilegedAction;
import java.util.List;
import java.util.stream.Collectors;
final class GetAllProcessesInfoAction implements PrivilegedAction> {
@Override
public List run() {
return ProcessHandle.allProcesses()
.map(processHandle -> new ProcessInfo(processHandle.pid(), processHandle.info().command().orElse(null)))
.collect(Collectors.toList());
}
}