You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@logging.apache.org by rp...@apache.org on 2016/03/16 14:38:52 UTC
[35/50] logging-log4j2 git commit: LOG4J2-1080 AsyncLoggerDisruptor
now supports trying to enqueue log events;
signalling false when the queue is full
LOG4J2-1080 AsyncLoggerDisruptor now supports trying to enqueue log events; signalling false when the queue is full
Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo
Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/32e30697
Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/32e30697
Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/32e30697
Branch: refs/heads/LOG4J2-1278-gc-free-logger
Commit: 32e30697d0638dc9139591e85658e21758920843
Parents: 7a7f5e4
Author: rpopma <rp...@apache.org>
Authored: Tue Mar 15 02:04:39 2016 +1100
Committer: rpopma <rp...@apache.org>
Committed: Tue Mar 15 02:04:39 2016 +1100
----------------------------------------------------------------------
.../logging/log4j/core/async/AsyncLoggerDisruptor.java | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/32e30697/log4j-core/src/main/java/org/apache/logging/log4j/core/async/AsyncLoggerDisruptor.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/async/AsyncLoggerDisruptor.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/async/AsyncLoggerDisruptor.java
index 3da2b3e..cb78ce6 100644
--- a/log4j-core/src/main/java/org/apache/logging/log4j/core/async/AsyncLoggerDisruptor.java
+++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/async/AsyncLoggerDisruptor.java
@@ -83,7 +83,7 @@ class AsyncLoggerDisruptor {
final WaitStrategy waitStrategy = DisruptorUtil.createWaitStrategy("AsyncLogger.WaitStrategy");
executor = Executors.newSingleThreadExecutor(new DaemonThreadFactory("AsyncLogger[" + contextName + "]"));
backgroundThreadId = DisruptorUtil.getExecutorThreadId(executor);
- asyncEventRouter = AsyncEventRouterFactory.create(ringBufferSize);
+ asyncEventRouter = AsyncEventRouterFactory.create();
disruptor = new Disruptor<>(RingBufferLogEvent.FACTORY, ringBufferSize, executor, ProducerType.MULTI,
waitStrategy);
@@ -164,7 +164,7 @@ class AsyncLoggerDisruptor {
if (remainingCapacity < 0) {
return EventRoute.DISCARD;
}
- return asyncEventRouter.getRoute(backgroundThreadId, logLevel, ringBufferSize, remainingCapacity);
+ return asyncEventRouter.getRoute(backgroundThreadId, logLevel);
}
private int remainingDisruptorCapacity() {
@@ -185,6 +185,10 @@ class AsyncLoggerDisruptor {
return false;
}
+ public boolean tryPublish(final RingBufferLogEventTranslator translator) {
+ return disruptor.getRingBuffer().tryPublishEvent(translator);
+ }
+
void enqueueLogMessageInfo(final RingBufferLogEventTranslator translator) {
// LOG4J2-639: catch NPE if disruptor field was set to null in stop()
try {