com.sun.enterprise.universal.process
Class ProcessUtils

java.lang.Object
  extended by com.sun.enterprise.universal.process.ProcessUtils

public final class ProcessUtils
extends java.lang.Object

Includes a somewhat kludgy way to get the pid for "me". Another casualty of the JDK catering to the LEAST common denominator. Some obscure OS might not have a pid! The name returned from the JMX method is like so: 12345@mycomputername where 12345 is the PID

Author:
bnevins

Method Summary
static java.io.File getExe(java.lang.String name)
           
static int getPid()
          Try and find the Process ID of "our" process.
static java.lang.Boolean isProcessRunning(int aPid)
          If we can determine it -- find out if the process that owns the given process id is running.
static java.lang.String kill(int pid)
          Kill the process with the given Process ID.
static void main(java.lang.String[] args)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

main

public static void main(java.lang.String[] args)

getExe

public static java.io.File getExe(java.lang.String name)

getPid

public static final int getPid()
Try and find the Process ID of "our" process.

Returns:
the process id or -1 if not known

kill

public static java.lang.String kill(int pid)
Kill the process with the given Process ID.

Parameters:
pid -
Returns:
a String if the process was not killed for any reason including if it does not exist. Return null if it was killed.

isProcessRunning

public static final java.lang.Boolean isProcessRunning(int aPid)
If we can determine it -- find out if the process that owns the given process id is running.

Parameters:
aPid -
Returns:
true if it's running, false if not and null if we don't know. I.e the return value is a true tri-state Boolean.


Copyright © 2012 GlassFish Community. All Rights Reserved.