|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.pf.util.SysUtil
public class SysUtil
Provides generally useful methods for system inquiries and other system related functionality.
For example it is strongly recommended to uset exit(int) rather
than System.exit(int) to terminate a JVM. It allows registered
listeners to be notified just before the exit happens.
| Field Summary | |
|---|---|
static java.lang.String |
OS_FAMILY_MACINTOSH
"macintosh" |
static java.lang.String |
OS_FAMILY_UNIX
"unix" |
static java.lang.String |
OS_FAMILY_UNKNOWN
"unknown" |
static java.lang.String |
OS_FAMILY_WINDOWS
"windows" |
| Method Summary | |
|---|---|
void |
addSystemExitListener(ISystemExitListener listener)
Add the given listener to an internal list so that it would be called right before system exit gets executed via the exit(int) method. |
static SysUtil |
current()
Returns the only instance this class supports (design pattern "Singleton") |
void |
exit(int rc)
Calling this method terminates the JVM. |
void |
exit(int rc,
long sleepBeforeExit)
Calling this method terminates the JVM after the specified sleep time. |
java.lang.String |
getOsFamily()
Returns the family name of the current oparting system according to the name specified in system property "os.name". |
boolean |
isEclipse()
Returns true if the environment is based on eclipse. |
boolean |
isWindows()
Returns true if the current operating-system is Windows. |
void |
removeSystemExitListener(ISystemExitListener listener)
Removes the given listener from the internal list so that it would not be notified anymore before system exit gets executed via the exit(int)
method. |
void |
sleep(long milliseconds)
Sets the current thread to sleep for the specified time in milliseconds or until it gets interrupted. |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final java.lang.String OS_FAMILY_UNKNOWN
public static final java.lang.String OS_FAMILY_WINDOWS
public static final java.lang.String OS_FAMILY_UNIX
public static final java.lang.String OS_FAMILY_MACINTOSH
| Method Detail |
|---|
public static SysUtil current()
public boolean isWindows()
public boolean isEclipse()
public java.lang.String getOsFamily()
OS_FAMILY_UNKNOWN,
OS_FAMILY_UNIX,
OS_FAMILY_MACINTOSH,
OS_FAMILY_WINDOWSpublic void sleep(long milliseconds)
milliseconds - The time to sleeppublic void exit(int rc)
rc - The return code to the program that started the JVM.
public void exit(int rc,
long sleepBeforeExit)
rc - The return code to the program that started the JVM.sleepBeforeExit - The time to sleep (in milliseconds) before exiting.public void addSystemExitListener(ISystemExitListener listener)
exit(int) method.
listener - The listener to add. Will be ignored if null.public void removeSystemExitListener(ISystemExitListener listener)
exit(int)
method.
listener - The listener to remove. Will be ignored if null.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||