ppkarwasz commented on code in PR #2230:
URL: https://github.com/apache/logging-log4j2/pull/2230#discussion_r1464991374


##########
log4j-core/src/main/java/org/apache/logging/log4j/core/async/DisruptorConfiguration.java:
##########
@@ -0,0 +1,132 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to you under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.logging.log4j.core.async;
+
+import java.util.Objects;
+import java.util.concurrent.TimeUnit;
+import org.apache.logging.log4j.Logger;
+import org.apache.logging.log4j.core.AbstractLifeCycle;
+import org.apache.logging.log4j.core.config.ConfigurationExtension;
+import org.apache.logging.log4j.plugins.Configurable;
+import org.apache.logging.log4j.plugins.Plugin;
+import org.apache.logging.log4j.plugins.PluginAliases;
+import org.apache.logging.log4j.plugins.PluginBuilderAttribute;
+import org.apache.logging.log4j.plugins.PluginFactory;
+import org.apache.logging.log4j.status.StatusLogger;
+import org.apache.logging.log4j.util.LoaderUtil;
+
+@Configurable(printObject = true)
+@Plugin("Disruptor")
+@PluginAliases("AsyncWaitStrategyFactory")
+public final class DisruptorConfiguration extends AbstractLifeCycle implements 
ConfigurationExtension {
+
+    private static final Logger LOGGER = StatusLogger.getLogger();
+
+    private final AsyncWaitStrategyFactory waitStrategyFactory;
+    private AsyncLoggerConfigDisruptor loggerConfigDisruptor;
+
+    private DisruptorConfiguration(final AsyncWaitStrategyFactory 
waitStrategyFactory) {
+        this.waitStrategyFactory = waitStrategyFactory;
+    }
+
+    public AsyncWaitStrategyFactory getWaitStrategyFactory() {
+        return waitStrategyFactory;
+    }
+
+    public AsyncLoggerConfigDelegate getAsyncLoggerConfigDelegate() {
+        if (loggerConfigDisruptor == null) {
+            loggerConfigDisruptor = new 
AsyncLoggerConfigDisruptor(waitStrategyFactory);
+        }

Review Comment:
   This was moved from:
   
   
https://github.com/apache/logging-log4j2/blob/03f3aebe5a6775de5a0b087465ebd981fc869056/log4j-core/src/main/java/org/apache/logging/log4j/core/config/AbstractConfiguration.java#L249-L256
   
   The disruptor is created only if it is needed, so I would go for `Lazy` here.



-- 
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: notifications-unsubscr...@logging.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to