1540
1541 // Private method to load the global handlers.
1542 // We do the real work lazily, when the global handlers
1543 // are first used.
1544 private synchronized void initializeGlobalHandlers() {
1545 if (initializedGlobalHandlers) {
1546 return;
1547 }
1548
1549 initializedGlobalHandlers = true;
1550
1551 if (deathImminent) {
1552 // Aaargh...
1553 // The VM is shutting down and our exit hook has been called.
1554 // Avoid allocating global handlers.
1555 return;
1556 }
1557 loadLoggerHandlers(rootLogger, null, "handlers");
1558 }
1559
1560 private final Permission controlPermission = new LoggingPermission("control", null);
1561
1562 void checkPermission() {
1563 SecurityManager sm = System.getSecurityManager();
1564 if (sm != null)
1565 sm.checkPermission(controlPermission);
1566 }
1567
1568 /**
1569 * Check that the current context is trusted to modify the logging
1570 * configuration. This requires LoggingPermission("control").
1571 * <p>
1572 * If the check fails we throw a SecurityException, otherwise
1573 * we return normally.
1574 *
1575 * @exception SecurityException if a security manager exists and if
1576 * the caller does not have LoggingPermission("control").
1577 */
1578 public void checkAccess() throws SecurityException {
1579 checkPermission();
1580 }
|
1540
1541 // Private method to load the global handlers.
1542 // We do the real work lazily, when the global handlers
1543 // are first used.
1544 private synchronized void initializeGlobalHandlers() {
1545 if (initializedGlobalHandlers) {
1546 return;
1547 }
1548
1549 initializedGlobalHandlers = true;
1550
1551 if (deathImminent) {
1552 // Aaargh...
1553 // The VM is shutting down and our exit hook has been called.
1554 // Avoid allocating global handlers.
1555 return;
1556 }
1557 loadLoggerHandlers(rootLogger, null, "handlers");
1558 }
1559
1560 static final Permission controlPermission = new LoggingPermission("control", null);
1561
1562 void checkPermission() {
1563 SecurityManager sm = System.getSecurityManager();
1564 if (sm != null)
1565 sm.checkPermission(controlPermission);
1566 }
1567
1568 /**
1569 * Check that the current context is trusted to modify the logging
1570 * configuration. This requires LoggingPermission("control").
1571 * <p>
1572 * If the check fails we throw a SecurityException, otherwise
1573 * we return normally.
1574 *
1575 * @exception SecurityException if a security manager exists and if
1576 * the caller does not have LoggingPermission("control").
1577 */
1578 public void checkAccess() throws SecurityException {
1579 checkPermission();
1580 }
|