Skip to content

Commit

Permalink
[async] use offer and not add which fails
Browse files Browse the repository at this point in the history
  • Loading branch information
rmannibucau committed Nov 15, 2023
1 parent 7502f30 commit 0ec0e5d
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ public AsyncHandler() {

queueSize = ofNullable(logManager.apply(className + ".queue.size"))
.map(Integer::parseInt)
.orElse(512);
.orElse(1024);
this.queue = new ArrayBlockingQueue<>(queueSize);

final var workerCount = ofNullable(logManager.apply(className + ".worker.count"))
Expand Down Expand Up @@ -140,7 +140,9 @@ public void publish(final LogRecord record) {
// infer in context if needed
record.getSourceClassName();
record.getSourceMethodName();
queue.add(record);
if (!queue.offer(record)) {
delegate.publish(record);
}
}
}

Expand Down

0 comments on commit 0ec0e5d

Please # to comment.