< prev index next >
src/java.logging/share/classes/java/util/logging/LogManager.java
Print this page
*** 37,48 ****
import java.util.function.BiFunction;
import java.util.function.Function;
import java.util.function.Predicate;
import java.util.stream.Collectors;
import java.util.stream.Stream;
- import jdk.internal.access.JavaAWTAccess;
- import jdk.internal.access.SharedSecrets;
import sun.util.logging.internal.LoggingProviderImpl;
import static jdk.internal.logger.DefaultLoggerFinder.isSystem;
/**
* There is a single global LogManager object that is used to
--- 37,46 ----
*** 451,491 ****
assert false : "Exception raised while reading logging configuration: " + ex;
}
}
}
! // LoggerContext maps from AppContext
! private WeakHashMap<Object, LoggerContext> contextsMap = null;
!
! // Returns the LoggerContext for the user code (i.e. application or AppContext).
! // Loggers are isolated from each AppContext.
private LoggerContext getUserContext() {
! LoggerContext context = null;
!
! SecurityManager sm = System.getSecurityManager();
! JavaAWTAccess javaAwtAccess = SharedSecrets.getJavaAWTAccess();
! if (sm != null && javaAwtAccess != null) {
! // for each applet, it has its own LoggerContext isolated from others
! final Object ecx = javaAwtAccess.getAppletContext();
! if (ecx != null) {
! synchronized (javaAwtAccess) {
! // find the AppContext of the applet code
! // will be null if we are in the main app context.
! if (contextsMap == null) {
! contextsMap = new WeakHashMap<>();
! }
! context = contextsMap.get(ecx);
! if (context == null) {
! // Create a new LoggerContext for the applet.
! context = new LoggerContext();
! contextsMap.put(ecx, context);
! }
! }
! }
! }
! // for standalone app, return userContext
! return context != null ? context : userContext;
}
// The system context.
final LoggerContext getSystemContext() {
return systemContext;
--- 449,461 ----
assert false : "Exception raised while reading logging configuration: " + ex;
}
}
}
! // Returns the LoggerContext for the user code (i.e. application).
private LoggerContext getUserContext() {
! return userContext;
}
// The system context.
final LoggerContext getSystemContext() {
return systemContext;
< prev index next >