I2P Address: [http://git.idk.i2p]

Skip to content
Snippets Groups Projects
Commit 9cccd0bf authored by jrandom's avatar jrandom Committed by zzz
Browse files

rather than flush any/all log messages 10 times a second, flush log messages...

rather than flush any/all log messages 10 times a second, flush log messages once there are 100 of them or 10 seconds have passed, whichever comes first
parent e57c010e
No related branches found
No related tags found
No related merge requests found
......@@ -209,8 +209,18 @@ public class LogManager {
*
*/
void addRecord(LogRecord record) {
int numRecords = 0;
synchronized (_records) {
_records.add(record);
numRecords = _records.size();
}
if (numRecords > 100) {
// the writer waits 10 seconds *or* until we tell them to wake up
// before rereading the config and writing out any log messages
synchronized (_writer) {
_writer.notifyAll();
}
}
}
......
......@@ -72,12 +72,15 @@ class LogWriter implements Runnable {
t.printStackTrace();
} finally {
try {
Thread.sleep(100);
synchronized (this) {
this.wait(10*1000);
}
} catch (InterruptedException ie) { // nop
}
}
}
private void rereadConfig() {
long now = Clock.getInstance().now();
if (now - _lastReadConfig > CONFIG_READ_ITERVAL) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment