|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object | +--com.caucho.util.Exit
The exit class is used to automatically clean state. For example, Resin JavaScript will close open files when the script exits. Here's a sample use:
boolean isExit = addExit();
try {
...
} finally {
if (isExit)
exit();
}
Objects register for the exit callback by calling
addExit(listener, object).
Exits are intrinsically tied to a thread.
| Method Summary | |
static boolean |
addExit()
Starts a protection scope. |
static void |
addExit(ExitListener listener,
java.lang.Object object)
Registers the object and listener. |
static void |
exit()
Calls all registered listeners. |
void |
handleAlarm(Alarm alarm)
A paranoid callback to clean up exits for threads which have died for some reason. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method Detail |
public static void addExit(ExitListener listener,
java.lang.Object object)
If there is no protection scope, i.e. addExit() hasn't been called, then this function does nothing.
listener - the exit handlerobject - the object which needs cleanuppublic static boolean addExit()
public static void exit()
public void handleAlarm(Alarm alarm)
handleAlarm in interface AlarmListener
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||