com.pelzer.util
Class PID

java.lang.Object
  extended by com.pelzer.util.PID

public class PID
extends Object

Wrapper around the unix concept of a process identifier. Only works if you're running on a system that has perl in the path.


Constructor Summary
PID()
           
 
Method Summary
static int getCurrentPID()
           
static boolean isPIDAlive(int pid)
          Returns true if the given pid is alive.
static void main(String[] args)
           
static int readPID(File pidFile)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PID

public PID()
Method Detail

getCurrentPID

public static int getCurrentPID()
Returns:
the pid of the current JVM. Requires that 'perl' be in the path otherwise returns -1

readPID

public static int readPID(File pidFile)
                   throws IOException,
                          NumberFormatException
Returns:
the parsed int read from the given pid file
Throws:
IOException
NumberFormatException

isPIDAlive

public static boolean isPIDAlive(int pid)
                          throws IOException
Returns true if the given pid is alive. Requires /bin/ps (ie UNIX)

Throws:
IOException

main

public static void main(String[] args)


Copyright © 2012. All Rights Reserved.