src/share/classes/java/util/logging/MemoryHandler.java

Print this page

        

@@ -186,10 +186,11 @@
      * <tt>Handler</tt>.
      *
      * @param  record  description of the log event. A null record is
      *                 silently ignored and is not published
      */
+    @Override
     public synchronized void publish(LogRecord record) {
         if (!isLoggable(record)) {
             return;
         }
         int ix = (start+count)%buffer.length;

@@ -225,10 +226,11 @@
      * Causes a flush on the target <tt>Handler</tt>.
      * <p>
      * Note that the current contents of the <tt>MemoryHandler</tt>
      * buffer are <b>not</b> written out.  That requires a "push".
      */
+    @Override
     public void flush() {
         target.flush();
     }
 
     /**

@@ -236,10 +238,11 @@
      * This will also close the target <tt>Handler</tt>.
      *
      * @exception  SecurityException  if a security manager exists and if
      *             the caller does not have <tt>LoggingPermission("control")</tt>.
      */
+    @Override
     public void close() throws SecurityException {
         target.close();
         setLevel(Level.OFF);
     }
 

@@ -256,12 +259,14 @@
         if (newLevel == null) {
             throw new NullPointerException();
         }
         LogManager manager = LogManager.getLogManager();
         checkPermission();
+        synchronized (this) {
         pushLevel = newLevel;
     }
+    }
 
     /**
      * Get the <tt>pushLevel</tt>.
      *
      * @return the value of the <tt>pushLevel</tt>

@@ -281,9 +286,10 @@
      * <p>
      * @param record  a <tt>LogRecord</tt>
      * @return true if the <tt>LogRecord</tt> would be logged.
      *
      */
+    @Override
     public boolean isLoggable(LogRecord record) {
         return super.isLoggable(record);
     }
 }