|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.caucho.util.Exit
public class 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. |
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()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |