55 * The ASF licenses this file to You under the Apache License, Version 2.0
66 * (the "License"); you may not use this file except in compliance with
77 * the License. You may obtain a copy of the License at
8- *
8+ *
99 * http://www.apache.org/licenses/LICENSE-2.0
10- *
10+ *
1111 * Unless required by applicable law or agreed to in writing, software
1212 * distributed under the License is distributed on an "AS IS" BASIS,
1313 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2626 * class. This class does not add its own configuration properties for the
2727 * logging configuration, but relies on the following system properties
2828 * instead:</p>
29- *
29+ *
3030 * <ul>
3131 * <li><code>org.apache.juli.AsyncOverflowDropType</code>
3232 * Default value: <code>1</code></li>
3535 * <li><code>org.apache.juli.AsyncLoggerPollInterval</code>
3636 * Default value: <code>1000</code></li>
3737 * </ul>
38- *
38+ *
3939 * <p>See the System Properties page in the configuration reference of Tomcat.</p>
40- *
40+ *
4141 * @author Filip Hanik
4242 *
4343 */
@@ -47,21 +47,21 @@ public class AsyncFileHandler extends FileHandler {
4747 public static final int OVERFLOW_DROP_FIRST = 2 ;
4848 public static final int OVERFLOW_DROP_FLUSH = 3 ;
4949 public static final int OVERFLOW_DROP_CURRENT = 4 ;
50-
50+
5151 public static final int OVERFLOW_DROP_TYPE = Integer .parseInt (System .getProperty ("org.apache.juli.AsyncOverflowDropType" ,"1" ));
5252 public static final int DEFAULT_MAX_RECORDS = Integer .parseInt (System .getProperty ("org.apache.juli.AsyncMaxRecordCount" ,"10000" ));
5353 public static final int LOGGER_SLEEP_TIME = Integer .parseInt (System .getProperty ("org.apache.juli.AsyncLoggerPollInterval" ,"1000" ));
54-
54+
5555 protected static LinkedBlockingDeque <LogEntry > queue = new LinkedBlockingDeque <LogEntry >(DEFAULT_MAX_RECORDS );
56-
56+
5757 protected static LoggerThread logger = new LoggerThread ();
58-
58+
5959 static {
6060 logger .start ();
6161 }
62-
62+
6363 protected volatile boolean closed = false ;
64-
64+
6565 public AsyncFileHandler () {
6666 this (null ,null ,null );
6767 }
@@ -78,15 +78,15 @@ public void close() {
7878 // TODO Auto-generated method stub
7979 super .close ();
8080 }
81-
81+
8282 @ Override
8383 protected void open () {
8484 if (!closed ) return ;
8585 closed = false ;
8686 // TODO Auto-generated method stub
8787 super .open ();
8888 }
89-
89+
9090
9191 @ Override
9292 public void publish (LogRecord record ) {
@@ -100,7 +100,7 @@ public void publish(LogRecord record) {
100100 switch (OVERFLOW_DROP_TYPE ) {
101101 case OVERFLOW_DROP_LAST : {
102102 //remove the last added element
103- queue .pollLast ();
103+ queue .pollLast ();
104104 break ;
105105 }
106106 case OVERFLOW_DROP_FIRST : {
@@ -123,9 +123,9 @@ public void publish(LogRecord record) {
123123 //after this we clear the flag
124124 Thread .interrupted ();
125125 }
126-
126+
127127 }
128-
128+
129129 protected void publishInternal (LogRecord record ) {
130130 super .publish (record );
131131 }
@@ -136,7 +136,7 @@ public LoggerThread() {
136136 this .setDaemon (true );
137137 this .setName ("AsyncFileHandlerWriter-" +System .identityHashCode (this ));
138138 }
139-
139+
140140 @ Override
141141 public void run () {
142142 while (run ) {
@@ -151,7 +151,7 @@ public void run() {
151151 }//while
152152 }
153153 }
154-
154+
155155 protected static class LogEntry {
156156 private LogRecord record ;
157157 private AsyncFileHandler handler ;
@@ -160,7 +160,7 @@ public LogEntry(LogRecord record, AsyncFileHandler handler) {
160160 this .record = record ;
161161 this .handler = handler ;
162162 }
163-
163+
164164 public boolean flush () {
165165 if (handler .closed ) {
166166 return false ;
@@ -169,8 +169,8 @@ public boolean flush() {
169169 return true ;
170170 }
171171 }
172-
172+
173173 }
174-
175-
174+
175+
176176}
0 commit comments