carterkozak commented on a change in pull request #273: LOG4J2-2606: 
Substantially improve async logging performance under heavy load
URL: https://github.com/apache/logging-log4j2/pull/273#discussion_r286754726
 
 

 ##########
 File path: 
log4j-core/src/main/java/org/apache/logging/log4j/core/async/DisruptorUtil.java
 ##########
 @@ -153,4 +155,43 @@ public Long call() {
             throw new IllegalStateException(msg, ex);
         }
     }
+
+    /**
+     * Creates a new {@link Semaphore} or null based on
+     * <pre>AsyncLogger.AsyncQueueFullEnqueueSemaphorePermits</pre>.
+     */
+    static Semaphore createAsyncLoggerQueueFullEnqueuSemaphore() {
+        return 
createAsyncQueueFullEnqueuSemaphore("AsyncLogger.AsyncQueueFullEnqueueSemaphorePermits");
+    }
+
+    /**
+     * Creates a new {@link Semaphore} or null based on
+     * <pre>AsyncLoggerConfig.AsyncQueueFullEnqueueSemaphorePermits</pre>.
+     */
+    static Semaphore createAsyncConfigQueueFullEnqueuSemaphore() {
+        return 
createAsyncQueueFullEnqueuSemaphore("AsyncLoggerConfig.AsyncQueueFullEnqueueSemaphorePermits");
+    }
+
+    /**
+     * LOG4J2-2606: Disruptor spins enqueuing events across multiple threads 
when the queue is full.
+     * CPU utilization is significantly reduced by restricting access to the 
enqueue operation.
+     * Non-positive values disable the semaphore.
+     */
+    private static Semaphore createAsyncQueueFullEnqueuSemaphore(String 
property) {
 
 Review comment:
   > Nit: ...EnqueuSemaphore -> ...EnqueueSemaphore
   
   Oops, that's embarrassing! Fixed and updated the comment based on your 
suggestion.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to