クラス ProcessTerminator
java.lang.Object
com.kazurayam.subprocessj.ProcessTerminator
killProcessListeningPort(int portNumber) identifies the running process
that is listening the IP port #portNumber, get the Process ID,
then kill the process.
I want this class to run on Java 8. Therefore I can not rely on the
`long pid()` method of `java.lang.Process` which was added at Java 9.
So I will use `lsof -i:portNumber -P` command on Mac
on Windows? TODO later
-
ネストされたクラスの概要
ネストされたクラス修飾子とタイプクラス説明static class
A Data Transfer Object that contains the return code, STDOUT of `lsof -i:port -P` command that reveals how ProcessKiller worked. -
コンストラクタの概要
コンストラクタ -
メソッドの概要
-
コンストラクタの詳細
-
ProcessTerminator
public ProcessTerminator()
-
-
メソッドの詳細
-
killProcessOnPort
public static ProcessTerminator.ProcessTerminationResult killProcessOnPort(int portNumber) throws IOException, InterruptedException - パラメータ:
portNumber
- the IP port number on which the Process is hanging on; you want to kill that process.- 戻り値:
- the ID of the process (>0) which is listening to the IP portNumber and therefore killed; returns -1 if the process was not found.
- 例外:
IOException
- if failed to kill a OS processInterruptedException
- if the process was interrupted
-
killProcessByPid
public static ProcessTerminator.ProcessTerminationResult killProcessByPid(ProcessFinder.ProcessFindingResult pfr) throws IOException, InterruptedException -
main
-