パッケージ com.kazurayam.subprocessj

クラス ProcessFinder


  • public class ProcessFinder
    extends java.lang.Object
    • メソッドの詳細

      • 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