jdk/src/share/classes/sun/util/logging/PlatformLogger.java
changeset 7803 56bc97d69d93
parent 7026 9f2ec5fad124
child 7816 55a18147b4bf
equal deleted inserted replaced
7802:74f2ee2b62ba 7803:56bc97d69d93
   111             });
   111             });
   112     }
   112     }
   113 
   113 
   114     // Table of known loggers.  Maps names to PlatformLoggers.
   114     // Table of known loggers.  Maps names to PlatformLoggers.
   115     private static Map<String,WeakReference<PlatformLogger>> loggers =
   115     private static Map<String,WeakReference<PlatformLogger>> loggers =
   116         new HashMap<String,WeakReference<PlatformLogger>>();
   116         new HashMap<>();
   117 
   117 
   118     /**
   118     /**
   119      * Returns a PlatformLogger of a given name.
   119      * Returns a PlatformLogger of a given name.
   120      */
   120      */
   121     public static synchronized PlatformLogger getLogger(String name) {
   121     public static synchronized PlatformLogger getLogger(String name) {
   124         if (ref != null) {
   124         if (ref != null) {
   125             log = ref.get();
   125             log = ref.get();
   126         }
   126         }
   127         if (log == null) {
   127         if (log == null) {
   128             log = new PlatformLogger(name);
   128             log = new PlatformLogger(name);
   129             loggers.put(name, new WeakReference<PlatformLogger>(log));
   129             loggers.put(name, new WeakReference<>(log));
   130         }
   130         }
   131         return log;
   131         return log;
   132     }
   132     }
   133 
   133 
   134     /**
   134     /**
   486      * JavaLogger forwards all the calls to its corresponding
   486      * JavaLogger forwards all the calls to its corresponding
   487      * java.util.logging.Logger object.
   487      * java.util.logging.Logger object.
   488      */
   488      */
   489     static class JavaLogger extends LoggerProxy {
   489     static class JavaLogger extends LoggerProxy {
   490         private static final Map<Integer, Object> levelObjects =
   490         private static final Map<Integer, Object> levelObjects =
   491             new HashMap<Integer, Object>();
   491             new HashMap<>();
   492 
   492 
   493         static {
   493         static {
   494             if (LoggingSupport.isAvailable()) {
   494             if (LoggingSupport.isAvailable()) {
   495                 // initialize the map to Level objects
   495                 // initialize the map to Level objects
   496                 getLevelObjects();
   496                 getLevelObjects();