|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.lang.SecurityManager net.dclausen.util.ExitLogger
A simple SecurityManager
which logs calls to checkExit(int)
.
When an instance of ExitLogger
is installed as the System's default
SecurityManager
, it acts as a trap for System.exit(int)
and
Runtime.exit(int)
, because those two functions both call
System.getSecurityManager().checkExit()
before terminating the JVM.
All permission checks (including checkExit
) are forwarded to the
System's previous SecurityManager
, if one was set.
Use the static install(java.util.logging.Logger, java.util.logging.Level)
method to install a new instance of this class
as the System's SecurityManager
.
System.exit(int)
,
Runtime.exit(int)
,
SecurityManager
,
System.setSecurityManager(SecurityManager)
,
Logger
Field Summary |
Fields inherited from class java.lang.SecurityManager |
inCheck |
Method Summary | |
void |
checkExit(int status)
Use stack introspection to identify the calling class/method/line, and log it. |
void |
checkPermission(Permission perm)
Delegate the check to the parent SecurityManager, if there is one. |
static void |
install(Logger logger,
Level level)
Install an instance of ExitLogger as the System's SecurityManager . |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
public static void install(Logger logger, Level level)
SecurityManager
.
The existing SecurityManager
, if one exists, will be used as a
delegate for all permission checks.
logger
- the Logger to use when logging calls to System.exit() and
Runtime.exit()level
- the level to use
SecurityException
- if the current SecurityManager doesn't want to be
replacedSystem.setSecurityManager(java.lang.SecurityManager)
public void checkPermission(Permission perm)
public void checkExit(int status)
Runtime.exit(int)
before
actually stopping the JVM.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |