garydgregory commented on code in PR #824:
URL: https://github.com/apache/logging-log4j2/pull/824#discussion_r852902866


##########
log4j-core/src/main/java/org/apache/logging/log4j/core/async/DefaultAsyncWaitStrategyFactory.java:
##########
@@ -0,0 +1,79 @@
+package org.apache.logging.log4j.core.async;
+
+import com.lmax.disruptor.BlockingWaitStrategy;
+import com.lmax.disruptor.BusySpinWaitStrategy;
+import com.lmax.disruptor.SleepingWaitStrategy;
+import com.lmax.disruptor.TimeoutBlockingWaitStrategy;
+import com.lmax.disruptor.WaitStrategy;
+import com.lmax.disruptor.YieldingWaitStrategy;
+import org.apache.logging.log4j.Logger;
+import org.apache.logging.log4j.status.StatusLogger;
+import org.apache.logging.log4j.util.PropertiesUtil;
+import org.apache.logging.log4j.util.Strings;
+
+import java.util.concurrent.TimeUnit;
+
+class DefaultAsyncWaitStrategyFactory implements AsyncWaitStrategyFactory {
+    static final String DEFAULT_WAIT_STRATEGY_CLASSNAME = 
TimeoutBlockingWaitStrategy.class.getName();
+    private static final Logger LOGGER = StatusLogger.getLogger();
+    private final String propertyName;
+
+    public DefaultAsyncWaitStrategyFactory(String propertyName) {
+        this.propertyName = propertyName;
+    }
+
+    @Override
+    public WaitStrategy createWaitStrategy() {
+        final String strategy = 
PropertiesUtil.getProperties().getStringProperty(propertyName, "TIMEOUT");
+        LOGGER.trace("DefaultAsyncWaitStrategyFactory property {}={}", 
propertyName, strategy);
+        final String strategyUp = Strings.toRootUpperCase(strategy);
+        // String (not enum) is deliberately used here to avoid 
IllegalArgumentException being thrown. In case of
+        // incorrect property value, default WaitStrategy is created.
+        switch (strategyUp) {

Review Comment:
   Make an enum from these case values?



-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to