Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@
*/
public class AsyncFileHandler extends StreamHandler {
private static final LogRecord CLOSE_EVENT = new LogRecord(Level.FINEST, "CLOSE_EVENT"); //$NON-NLS-1$
private FileHandler fFileHandler;
private final FileHandler fFileHandler;
private BlockingQueue<List<LogRecord>> fQueue;
private Thread fWriterThread;
private int fMaxSize = 1024;
Expand All @@ -105,9 +105,7 @@ public class AsyncFileHandler extends StreamHandler {
TimerTask fTask = new TimerTask() {
@Override
public void run() {
if (!fRecordBuffer.isEmpty()) {
flush();
}
flush();
}
};

Expand Down Expand Up @@ -290,8 +288,10 @@ public synchronized void close() throws SecurityException {
@Override
public synchronized void flush() {
try {
fQueue.put(fRecordBuffer);
fRecordBuffer = new ArrayList<>(fMaxSize);
if (!fRecordBuffer.isEmpty()) {
fQueue.put(fRecordBuffer);
fRecordBuffer = new ArrayList<>(fMaxSize);
}
} catch (InterruptedException e) {
Thread.currentThread().interrupt();
}
Expand Down