クラス ProcessFinder
- java.lang.Object
-
- com.kazurayam.subprocessj.ProcessFinder
-
public class ProcessFinder extends java.lang.Object
-
-
ネストされたクラスの概要
ネストされたクラス 修飾子とタイプ クラス 説明 static class
ProcessFinder.ProcessFindingResult
-
メソッドの概要
すべてのメソッド staticメソッド concreteメソッド 修飾子とタイプ メソッド 説明 static long
findCurrentJvmPid()
static ProcessFinder.ProcessFindingResult
findPidByListeningPort(int port)
Given an IP Port number, identify the id of OS process that is listening to the port.static java.lang.String
makeRegexForFilteringWindowsNetstatOutput(int port)
$ netstat -ano | find "LISTEN" | find "80" TCP 0.0.0.0:13688 0.0.0.0:0 LISTENING 4080 TCP [::]:13688 [::]:0 LISTENING 4080
-
-
-
メソッドの詳細
-
findCurrentJvmPid
public static long findCurrentJvmPid()
- 戻り値:
- the process id of the OS process in which the current JVM is working
-
findPidByListeningPort
public static ProcessFinder.ProcessFindingResult findPidByListeningPort(int port)
Given an IP Port number, identify the id of OS process that is listening to the port. This will use OS-dependent commands, for example `lsof -i:portNumber -P` on Mac and Linux.- パラメータ:
port
- IP port- 戻り値:
- FindingResult includes returncode
-
makeRegexForFilteringWindowsNetstatOutput
public static java.lang.String makeRegexForFilteringWindowsNetstatOutput(int port)
$ netstat -ano | find "LISTEN" | find "80" TCP 0.0.0.0:13688 0.0.0.0:0 LISTENING 4080 TCP [::]:13688 [::]:0 LISTENING 4080
protocol local-address exteria-address state process-id- パラメータ:
port
- IP port- 戻り値:
- a String as a Regular Expression pattern
-
-