public class MacOsProcessTable extends Object implements ProcessTable
ProcessTable
for MacOS-based systems.ProcessTable.Factory
Constructor and Description |
---|
MacOsProcessTable() |
Modifier and Type | Method and Description |
---|---|
java.util.stream.Stream<Integer> |
getAllPids()
Get all PIDs running on the system.
|
List<Integer> |
getJavaPid(@Nullable java.util.stream.Stream<Integer> possiblePids,
Class<?> clazz)
Gets a Java PID running with the given class.
|
java.util.stream.Stream<Integer> |
getJavaPids()
Gets all the Java PIDs on the system that are readable by the current process.
|
boolean |
isProcessAlive(int pid) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
isProcessDead, stopProcess
public java.util.stream.Stream<Integer> getJavaPids() throws IOException
ProcessTable
getJavaPids
in interface ProcessTable
IOException
- if the /proc filesystem is not availablepublic java.util.stream.Stream<Integer> getAllPids() throws IOException
ProcessTable
getAllPids
in interface ProcessTable
IOException
- if the program cannot read the process tablepublic List<Integer> getJavaPid(@Nullable @Nullable java.util.stream.Stream<Integer> possiblePids, Class<?> clazz) throws IOException
ProcessTable
getJavaPid
in interface ProcessTable
possiblePids
- a list of PIDs to check. If null, it will check all PIDs on the systemclazz
- the main class of the process that should be runningIOException
public boolean isProcessAlive(int pid)
isProcessAlive
in interface ProcessTable
pid
- pid to testCopyright © 2023. All Rights Reserved.