logging-log4j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Matt Sicker <boa...@gmail.com>
Subject Re: [13/36] logging-log4j2 git commit: Convert BlockingQueueFactory into a plugin element
Date Tue, 06 Sep 2016 19:19:07 GMT
John is working on making a release that uses Java 1.7.

On 6 September 2016 at 14:01, Ralph Goers <ralph.goers@dslextreme.com>
wrote:

> I only run the release build using the compiler for the target release.
> All the target option really does is set the release version to the correct
> value and verify you aren’t using language constructs from the newer java
> version. Using Java 8 with a target of Java 7 runs the risk that you still
> might be dependent on Java 8 library methods and not know about it.
>
> So whatever solution you come up with needs to work when running the build
> with Java 7.
>
> Ralph
>
>
>
>
> On Sep 6, 2016, at 9:23 AM, Matt Sicker <boards@gmail.com> wrote:
>
> By that I mean they set their compiler version to 1.6 for src/main/ and
> 1.8 for src/test/ which shouldn't affect us as we're not using their test
> artifact.
>
> On 6 September 2016 at 11:22, Matt Sicker <boards@gmail.com> wrote:
>
>> JCTools requires 1.6 for the build and 1.8 for the test. It appears we
>> could do the same if the only thing failing the build is a unit test, but
>> if the whole build is failing on Java 7, then I can back out those changes
>> into a separate branch for future inclusion.
>>
>> On 6 September 2016 at 11:18, Remko Popma <remko.popma@gmail.com> wrote:
>>
>>> Does JCTools require Java 8? One option is for this release to leave out
>>> the Conversant library and only include JCTools and the TransferQueue.
>>>
>>> On Wed, Sep 7, 2016 at 1:06 AM, Matt Sicker <boards@gmail.com> wrote:
>>>
>>>> I can't believe I didn't notice it, but the Conversant library does
>>>> require Java 8. It's an optional dependency, so what to do? We can build on
>>>> Java 8 with a target for Java 7 and use the animal-sniffer Maven plugin to
>>>> make sure we don't accidentally use anything from Java 8.
>>>>
>>>> On 5 September 2016 at 22:45, Matt Sicker <boards@gmail.com> wrote:
>>>>
>>>>> It looks like I may have merged prematurely then. I think I've been
>>>>> running builds using Java 8 as well and didn't notice this. Jenkins isn't
>>>>> even loading for me, so I can't see what the problem is on there. I'll take
>>>>> a look at this tomorrow, and if I can't fix the dependency issue, I'll back
>>>>> out part of this feature for now.
>>>>>
>>>>> On 5 September 2016 at 17:03, Ralph Goers <ralph.goers@dslextreme.com>
>>>>> wrote:
>>>>>
>>>>>> Jenkins and the release builds use Java 7, so you should certainly
>>>>>> use Java 7 from time to time.
>>>>>>
>>>>>> Ralph
>>>>>>
>>>>>> On Sep 5, 2016, at 2:33 PM, Gary Gregory <garydgregory@gmail.com>
>>>>>> wrote:
>>>>>>
>>>>>> Ah, no, Java 8:
>>>>>>
>>>>>> Apache Maven 3.3.9 (bb52d8502b132ec0a5a3f4c09453c07478323dc5;
>>>>>> 2015-11-10T08:41:47-08:00)
>>>>>> Maven home: E:\Java\apache-maven-3.3.9
>>>>>> Java version: 1.8.0_101, vendor: Oracle Corporation
>>>>>> Java home: C:\Program Files\Java\jdk1.8.0_101\jre
>>>>>> Default locale: en_US, platform encoding: Cp1252
>>>>>> OS name: "windows 7", version: "6.1", arch: "amd64", family: "dos"
>>>>>>
>>>>>> Gary
>>>>>>
>>>>>> On Mon, Sep 5, 2016 at 5:32 PM, Ralph Goers <
>>>>>> ralph.goers@dslextreme.com> wrote:
>>>>>>
>>>>>>> And you are building with Java 7?
>>>>>>>
>>>>>>> Ralph
>>>>>>>
>>>>>>> On Sep 5, 2016, at 2:18 PM, Gary Gregory <garydgregory@gmail.com>
>>>>>>> wrote:
>>>>>>>
>>>>>>> Locally, I get:
>>>>>>>
>>>>>>> Failed tests:
>>>>>>>   RoutingAppenderWithPurgingTest.routingTest:91 Incorrect number of
>>>>>>> appenders with IdlePurgePolicy. expected:<3> but was:<1>
>>>>>>>
>>>>>>> Gary
>>>>>>>
>>>>>>> On Mon, Sep 5, 2016 at 12:54 PM, Ralph Goers <
>>>>>>> ralph.goers@dslextreme.com> wrote:
>>>>>>>
>>>>>>>> For the record, I am voting -1 on this commit.  It breaks the build
>>>>>>>> because the DisruptorBlockingQueueFactory has a dependency that requires
>>>>>>>> Java 8. The 2.7 release is blocked until this is corrected.
>>>>>>>>
>>>>>>>> Ralph
>>>>>>>>
>>>>>>>> > On Sep 4, 2016, at 11:38 AM, mattsicker@apache.org wrote:
>>>>>>>> >
>>>>>>>> > Convert BlockingQueueFactory into a plugin element
>>>>>>>> >
>>>>>>>> > Related to LOG4J2-1430.
>>>>>>>> >
>>>>>>>> >
>>>>>>>> > Project: http://git-wip-us.apache.org/r
>>>>>>>> epos/asf/logging-log4j2/repo
>>>>>>>> > Commit: http://git-wip-us.apache.org/r
>>>>>>>> epos/asf/logging-log4j2/commit/65ec9bce
>>>>>>>> > Tree: http://git-wip-us.apache.org/r
>>>>>>>> epos/asf/logging-log4j2/tree/65ec9bce
>>>>>>>> > Diff: http://git-wip-us.apache.org/r
>>>>>>>> epos/asf/logging-log4j2/diff/65ec9bce
>>>>>>>> >
>>>>>>>> > Branch: refs/heads/master
>>>>>>>> > Commit: 65ec9bcef74dc30ecab9c2091c6e0638d53490d8
>>>>>>>> > Parents: 0848d7a
>>>>>>>> > Author: Matt Sicker <boards@gmail.com>
>>>>>>>> > Authored: Fri Jun 17 18:51:08 2016 -0500
>>>>>>>> > Committer: Matt Sicker <boards@gmail.com>
>>>>>>>> > Committed: Fri Jun 17 18:51:08 2016 -0500
>>>>>>>> >
>>>>>>>> > ------------------------------------------------------------
>>>>>>>> ----------
>>>>>>>> > .../log4j/core/appender/AsyncAppender.java      | 24 +++++++++---
>>>>>>>> > .../core/async/ArrayBlockingQueueFactory.java   | 10 +++++
>>>>>>>> > .../log4j/core/async/BlockingQueueFactory.java  | 13 ++++++-
>>>>>>>> > .../async/DisruptorBlockingQueueFactory.java    | 11 +++++-
>>>>>>>> > .../core/async/LinkedTransferQueueFactory.java  | 10 +++++
>>>>>>>> > .../log4j/core/appender/AsyncAppenderTest.java  | 16 ++++----
>>>>>>>> > .../BlockingQueueFactory-ArrayBlockingQueue.xml | 40
>>>>>>>> ++++++++++++++++++++
>>>>>>>> > ...ckingQueueFactory-DisruptorBlockingQueue.xml | 40
>>>>>>>> ++++++++++++++++++++
>>>>>>>> > ...BlockingQueueFactory-LinkedTransferQueue.xml | 40
>>>>>>>> ++++++++++++++++++++
>>>>>>>> > 9 files changed, 189 insertions(+), 15 deletions(-)
>>>>>>>> > ------------------------------------------------------------
>>>>>>>> ----------
>>>>>>>> >
>>>>>>>> >
>>>>>>>> > http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/6
>>>>>>>> 5ec9bce/log4j-core/src/main/java/org/apache/logging/log4j/co
>>>>>>>> re/appender/AsyncAppender.java
>>>>>>>> > ------------------------------------------------------------
>>>>>>>> ----------
>>>>>>>> > diff --git a/log4j-core/src/main/java/org
>>>>>>>> /apache/logging/log4j/core/appender/AsyncAppender.java
>>>>>>>> b/log4j-core/src/main/java/org/apache/logging/log4j/core/app
>>>>>>>> ender/AsyncAppender.java
>>>>>>>> > index 3c9c37c..dee5e50 100644
>>>>>>>> > --- a/log4j-core/src/main/java/org/apache/logging/log4j/core/app
>>>>>>>> ender/AsyncAppender.java
>>>>>>>> > +++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/app
>>>>>>>> ender/AsyncAppender.java
>>>>>>>> > @@ -26,8 +26,11 @@ import org.apache.logging.log4j.core.
>>>>>>>> AbstractLogEvent;
>>>>>>>> > import org.apache.logging.log4j.core.Appender;
>>>>>>>> > import org.apache.logging.log4j.core.Filter;
>>>>>>>> > import org.apache.logging.log4j.core.LogEvent;
>>>>>>>> > +import org.apache.logging.log4j.core.
>>>>>>>> async.ArrayBlockingQueueFactory;
>>>>>>>> > import org.apache.logging.log4j.core.async.AsyncQueueFullPolicy;
>>>>>>>> > import org.apache.logging.log4j.core.
>>>>>>>> async.AsyncQueueFullPolicyFactory;
>>>>>>>> > +import org.apache.logging.log4j.core.async.BlockingQueueFactory;
>>>>>>>> > +import org.apache.logging.log4j.core.
>>>>>>>> async.BlockingQueueFactoryUtil;
>>>>>>>> > import org.apache.logging.log4j.core.
>>>>>>>> async.DiscardingAsyncQueueFullPolicy;
>>>>>>>> > import org.apache.logging.log4j.core.async.EventRoute;
>>>>>>>> > import org.apache.logging.log4j.core.config.AppenderControl;
>>>>>>>> > @@ -42,7 +45,6 @@ import org.apache.logging.log4j.core.
>>>>>>>> config.plugins.PluginConfiguration;
>>>>>>>> > import org.apache.logging.log4j.core.
>>>>>>>> config.plugins.PluginElement;
>>>>>>>> > import org.apache.logging.log4j.core.
>>>>>>>> config.plugins.validation.constraints.Required;
>>>>>>>> > import org.apache.logging.log4j.core.impl.Log4jLogEvent;
>>>>>>>> > -import org.apache.logging.log4j.core.
>>>>>>>> async.BlockingQueueFactoryUtil;
>>>>>>>> > import org.apache.logging.log4j.core.util.Constants;
>>>>>>>> >
>>>>>>>> > /**
>>>>>>>> > @@ -73,8 +75,8 @@ public final class AsyncAppender extends
>>>>>>>> AbstractAppender {
>>>>>>>> >
>>>>>>>> >     private AsyncAppender(final String name, final Filter filter,
>>>>>>>> final AppenderRef[] appenderRefs,
>>>>>>>> >                           final String errorRef, final int
>>>>>>>> queueSize, final boolean blocking,
>>>>>>>> > -                          final boolean ignoreExceptions,
>>>>>>>> > -                          final long shutdownTimeout, final
>>>>>>>> Configuration config, final boolean includeLocation) {
>>>>>>>> > +                          final boolean ignoreExceptions, final
>>>>>>>> long shutdownTimeout, final Configuration config,
>>>>>>>> > +                          final boolean includeLocation, final
>>>>>>>> BlockingQueueFactory<LogEvent> blockingQueueFactory) {
>>>>>>>> >         super(name, filter, null, ignoreExceptions);
>>>>>>>> >         this.queue = BlockingQueueFactoryUtil.<LogE
>>>>>>>> vent>getBlockingQueueFactory().create(queueSize);
>>>>>>>> >         this.queueSize = queueSize;
>>>>>>>> > @@ -217,7 +219,9 @@ public final class AsyncAppender extends
>>>>>>>> AbstractAppender {
>>>>>>>> >     }
>>>>>>>> >
>>>>>>>> >     /**
>>>>>>>> > -     * Create an AsyncAppender.
>>>>>>>> > +     * Create an AsyncAppender. This method is retained for
>>>>>>>> backwards compatibility. New code should use the
>>>>>>>> > +     * {@link Builder} instead. This factory will use {@link
>>>>>>>> ArrayBlockingQueueFactory} by default as was the behavior
>>>>>>>> > +     * pre-2.7.
>>>>>>>> >      *
>>>>>>>> >      * @param appenderRefs     The Appenders to reference.
>>>>>>>> >      * @param errorRef         An optional Appender to write to
>>>>>>>> if the queue is full or other errors occur.
>>>>>>>> > @@ -247,7 +251,7 @@ public final class AsyncAppender extends
>>>>>>>> AbstractAppender {
>>>>>>>> >         }
>>>>>>>> >
>>>>>>>> >         return new AsyncAppender(name, filter, appenderRefs,
>>>>>>>> errorRef, size, blocking, ignoreExceptions,
>>>>>>>> > -            shutdownTimeout, config, includeLocation);
>>>>>>>> > +            shutdownTimeout, config, includeLocation, new
>>>>>>>> ArrayBlockingQueueFactory<LogEvent>());
>>>>>>>> >     }
>>>>>>>> >
>>>>>>>> >     @PluginBuilderFactory
>>>>>>>> > @@ -290,6 +294,9 @@ public final class AsyncAppender extends
>>>>>>>> AbstractAppender {
>>>>>>>> >         @PluginBuilderAttribute
>>>>>>>> >         private boolean ignoreExceptions = true;
>>>>>>>> >
>>>>>>>> > +        @PluginElement(BlockingQueueFactory.ELEMENT_TYPE)
>>>>>>>> > +        private BlockingQueueFactory<LogEvent>
>>>>>>>> blockingQueueFactory = new ArrayBlockingQueueFactory<>();
>>>>>>>> > +
>>>>>>>> >         public Builder setAppenderRefs(AppenderRef[]
>>>>>>>> appenderRefs) {
>>>>>>>> >             this.appenderRefs = appenderRefs;
>>>>>>>> >             return this;
>>>>>>>> > @@ -340,10 +347,15 @@ public final class AsyncAppender extends
>>>>>>>> AbstractAppender {
>>>>>>>> >             return this;
>>>>>>>> >         }
>>>>>>>> >
>>>>>>>> > +        public Builder setBlockingQueueFactory(final
>>>>>>>> BlockingQueueFactory<LogEvent> blockingQueueFactory) {
>>>>>>>> > +            this.blockingQueueFactory = blockingQueueFactory;
>>>>>>>> > +            return this;
>>>>>>>> > +        }
>>>>>>>> > +
>>>>>>>> >         @Override
>>>>>>>> >         public AsyncAppender build() {
>>>>>>>> >             return new AsyncAppender(name, filter, appenderRefs,
>>>>>>>> errorRef, bufferSize, blocking, ignoreExceptions,
>>>>>>>> > -                shutdownTimeout, configuration, includeLocation);
>>>>>>>> > +                shutdownTimeout, configuration, includeLocation,
>>>>>>>> blockingQueueFactory);
>>>>>>>> >         }
>>>>>>>> >     }
>>>>>>>> >
>>>>>>>> >
>>>>>>>> > http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/6
>>>>>>>> 5ec9bce/log4j-core/src/main/java/org/apache/logging/log4j/co
>>>>>>>> re/async/ArrayBlockingQueueFactory.java
>>>>>>>> > ------------------------------------------------------------
>>>>>>>> ----------
>>>>>>>> > diff --git a/log4j-core/src/main/java/org
>>>>>>>> /apache/logging/log4j/core/async/ArrayBlockingQueueFactory.java
>>>>>>>> b/log4j-core/src/main/java/org/apache/logging/log4j/core/asy
>>>>>>>> nc/ArrayBlockingQueueFactory.java
>>>>>>>> > index e9c99b8..dcad78a 100644
>>>>>>>> > --- a/log4j-core/src/main/java/org/apache/logging/log4j/core/asy
>>>>>>>> nc/ArrayBlockingQueueFactory.java
>>>>>>>> > +++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/asy
>>>>>>>> nc/ArrayBlockingQueueFactory.java
>>>>>>>> > @@ -3,14 +3,24 @@ package org.apache.logging.log4j.core.async;
>>>>>>>> > import java.util.concurrent.ArrayBlockingQueue;
>>>>>>>> > import java.util.concurrent.BlockingQueue;
>>>>>>>> >
>>>>>>>> > +import org.apache.logging.log4j.core.config.Node;
>>>>>>>> > +import org.apache.logging.log4j.core.config.plugins.Plugin;
>>>>>>>> > +import org.apache.logging.log4j.core.
>>>>>>>> config.plugins.PluginFactory;
>>>>>>>> > +
>>>>>>>> > /**
>>>>>>>> >  * Factory for creating instances of {@link ArrayBlockingQueue}.
>>>>>>>> >  *
>>>>>>>> >  * @since 2.7
>>>>>>>> >  */
>>>>>>>> > +@Plugin(name = "ArrayBlockingQueue", category = Node.CATEGORY,
>>>>>>>> elementType = BlockingQueueFactory.ELEMENT_TYPE)
>>>>>>>> > public class ArrayBlockingQueueFactory<E> implements
>>>>>>>> BlockingQueueFactory<E> {
>>>>>>>> >     @Override
>>>>>>>> >     public BlockingQueue<E> create(int capacity) {
>>>>>>>> >         return new ArrayBlockingQueue<>(capacity);
>>>>>>>> >     }
>>>>>>>> > +
>>>>>>>> > +    @PluginFactory
>>>>>>>> > +    public static <E> ArrayBlockingQueueFactory<E>
>>>>>>>> createFactory() {
>>>>>>>> > +        return new ArrayBlockingQueueFactory<>();
>>>>>>>> > +    }
>>>>>>>> > }
>>>>>>>> >
>>>>>>>> > http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/6
>>>>>>>> 5ec9bce/log4j-core/src/main/java/org/apache/logging/log4j/co
>>>>>>>> re/async/BlockingQueueFactory.java
>>>>>>>> > ------------------------------------------------------------
>>>>>>>> ----------
>>>>>>>> > diff --git a/log4j-core/src/main/java/org
>>>>>>>> /apache/logging/log4j/core/async/BlockingQueueFactory.java
>>>>>>>> b/log4j-core/src/main/java/org/apache/logging/log4j/core/asy
>>>>>>>> nc/BlockingQueueFactory.java
>>>>>>>> > index ccd1625..5763d1e 100644
>>>>>>>> > --- a/log4j-core/src/main/java/org/apache/logging/log4j/core/asy
>>>>>>>> nc/BlockingQueueFactory.java
>>>>>>>> > +++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/asy
>>>>>>>> nc/BlockingQueueFactory.java
>>>>>>>> > @@ -9,7 +9,18 @@ import java.util.concurrent.BlockingQueue;
>>>>>>>> >  */
>>>>>>>> > public interface BlockingQueueFactory<E> {
>>>>>>>> >
>>>>>>>> > -    String PROPERTY = "log4j.BlockingQueueFactory";
>>>>>>>> > +    /**
>>>>>>>> > +     * The {@link org.apache.logging.log4j.core.
>>>>>>>> config.plugins.Plugin#elementType() element type} to use for
>>>>>>>> plugins
>>>>>>>> > +     * implementing this interface.
>>>>>>>> > +     */
>>>>>>>> > +    String ELEMENT_TYPE = "BlockingQueueFactory";
>>>>>>>> >
>>>>>>>> > +    /**
>>>>>>>> > +     * Creates a new BlockingQueue with the specified maximum
>>>>>>>> capacity. Note that not all implementations of
>>>>>>>> > +     * BlockingQueue support a bounded capacity in which case
>>>>>>>> the value is ignored.
>>>>>>>> > +     *
>>>>>>>> > +     * @param capacity maximum size of the queue if supported
>>>>>>>> > +     * @return a new BlockingQueue
>>>>>>>> > +     */
>>>>>>>> >     BlockingQueue<E> create(int capacity);
>>>>>>>> > }
>>>>>>>> >
>>>>>>>> > http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/6
>>>>>>>> 5ec9bce/log4j-core/src/main/java/org/apache/logging/log4j/co
>>>>>>>> re/async/DisruptorBlockingQueueFactory.java
>>>>>>>> > ------------------------------------------------------------
>>>>>>>> ----------
>>>>>>>> > diff --git a/log4j-core/src/main/java/org
>>>>>>>> /apache/logging/log4j/core/async/DisruptorBlockingQueueFactory.java
>>>>>>>> b/log4j-core/src/main/java/org/apache/logging/log4j/core/asy
>>>>>>>> nc/DisruptorBlockingQueueFactory.java
>>>>>>>> > index 8fb3707..add375d 100644
>>>>>>>> > --- a/log4j-core/src/main/java/org/apache/logging/log4j/core/asy
>>>>>>>> nc/DisruptorBlockingQueueFactory.java
>>>>>>>> > +++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/asy
>>>>>>>> nc/DisruptorBlockingQueueFactory.java
>>>>>>>> > @@ -3,15 +3,24 @@ package org.apache.logging.log4j.core.async;
>>>>>>>> > import java.util.concurrent.BlockingQueue;
>>>>>>>> >
>>>>>>>> > import com.conversantmedia.util.concu
>>>>>>>> rrent.DisruptorBlockingQueue;
>>>>>>>> > +import org.apache.logging.log4j.core.config.Node;
>>>>>>>> > +import org.apache.logging.log4j.core.config.plugins.Plugin;
>>>>>>>> > +import org.apache.logging.log4j.core.
>>>>>>>> config.plugins.PluginFactory;
>>>>>>>> >
>>>>>>>> > /**
>>>>>>>> >  * Factory for creating instances of {@link
>>>>>>>> DisruptorBlockingQueue}.
>>>>>>>> >  *
>>>>>>>> >  * @since 2.7
>>>>>>>> >  */
>>>>>>>> > +@Plugin(name = "DisruptorBlockingQueue", category =
>>>>>>>> Node.CATEGORY, elementType = BlockingQueueFactory.ELEMENT_TYPE)
>>>>>>>> > public class DisruptorBlockingQueueFactory<E> implements
>>>>>>>> BlockingQueueFactory<E> {
>>>>>>>> >     @Override
>>>>>>>> >     public BlockingQueue<E> create(int capacity) {
>>>>>>>> > -        return new DisruptorBlockingQueue<E>(capacity);
>>>>>>>> > +        return new DisruptorBlockingQueue<>(capacity);
>>>>>>>> > +    }
>>>>>>>> > +
>>>>>>>> > +    @PluginFactory
>>>>>>>> > +    public static <E> DisruptorBlockingQueueFactory<E>
>>>>>>>> createFactory() {
>>>>>>>> > +        return new DisruptorBlockingQueueFactory<>();
>>>>>>>> >     }
>>>>>>>> > }
>>>>>>>> >
>>>>>>>> > http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/6
>>>>>>>> 5ec9bce/log4j-core/src/main/java/org/apache/logging/log4j/co
>>>>>>>> re/async/LinkedTransferQueueFactory.java
>>>>>>>> > ------------------------------------------------------------
>>>>>>>> ----------
>>>>>>>> > diff --git a/log4j-core/src/main/java/org
>>>>>>>> /apache/logging/log4j/core/async/LinkedTransferQueueFactory.java
>>>>>>>> b/log4j-core/src/main/java/org/apache/logging/log4j/core/asy
>>>>>>>> nc/LinkedTransferQueueFactory.java
>>>>>>>> > index 862fab3..6ab24e7 100644
>>>>>>>> > --- a/log4j-core/src/main/java/org/apache/logging/log4j/core/asy
>>>>>>>> nc/LinkedTransferQueueFactory.java
>>>>>>>> > +++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/asy
>>>>>>>> nc/LinkedTransferQueueFactory.java
>>>>>>>> > @@ -20,14 +20,24 @@ package org.apache.logging.log4j.core.async;
>>>>>>>> > import java.util.concurrent.BlockingQueue;
>>>>>>>> > import java.util.concurrent.LinkedTransferQueue;
>>>>>>>> >
>>>>>>>> > +import org.apache.logging.log4j.core.config.Node;
>>>>>>>> > +import org.apache.logging.log4j.core.config.plugins.Plugin;
>>>>>>>> > +import org.apache.logging.log4j.core.
>>>>>>>> config.plugins.PluginFactory;
>>>>>>>> > +
>>>>>>>> > /**
>>>>>>>> >  * Factory for creating instances of {@link LinkedTransferQueue}.
>>>>>>>> >  *
>>>>>>>> >  * @since 2.7
>>>>>>>> >  */
>>>>>>>> > +@Plugin(name = "LinkedTransferQueue", category = Node.CATEGORY,
>>>>>>>> elementType = BlockingQueueFactory.ELEMENT_TYPE)
>>>>>>>> > public class LinkedTransferQueueFactory<E> implements
>>>>>>>> BlockingQueueFactory<E> {
>>>>>>>> >     @Override
>>>>>>>> >     public BlockingQueue<E> create(int capacity) {
>>>>>>>> >         return new LinkedTransferQueue<>();
>>>>>>>> >     }
>>>>>>>> > +
>>>>>>>> > +    @PluginFactory
>>>>>>>> > +    public static <E> LinkedTransferQueueFactory<E>
>>>>>>>> createFactory() {
>>>>>>>> > +        return new LinkedTransferQueueFactory<>();
>>>>>>>> > +    }
>>>>>>>> > }
>>>>>>>> >
>>>>>>>> > http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/6
>>>>>>>> 5ec9bce/log4j-core/src/test/java/org/apache/logging/log4j/co
>>>>>>>> re/appender/AsyncAppenderTest.java
>>>>>>>> > ------------------------------------------------------------
>>>>>>>> ----------
>>>>>>>> > diff --git a/log4j-core/src/test/java/org
>>>>>>>> /apache/logging/log4j/core/appender/AsyncAppenderTest.java
>>>>>>>> b/log4j-core/src/test/java/org/apache/logging/log4j/core/app
>>>>>>>> ender/AsyncAppenderTest.java
>>>>>>>> > index 3066f38..076fdd0 100644
>>>>>>>> > --- a/log4j-core/src/test/java/org/apache/logging/log4j/core/app
>>>>>>>> ender/AsyncAppenderTest.java
>>>>>>>> > +++ b/log4j-core/src/test/java/org/apache/logging/log4j/core/app
>>>>>>>> ender/AsyncAppenderTest.java
>>>>>>>> > @@ -41,19 +41,21 @@ import static org.junit.Assert.*;
>>>>>>>> >  */
>>>>>>>> > @RunWith(Parameterized.class)
>>>>>>>> > public class AsyncAppenderTest {
>>>>>>>> > -    private static final String CONFIG = "log4j-asynch.xml";
>>>>>>>> >
>>>>>>>> >     @Parameterized.Parameters
>>>>>>>> >     public static Object[] data() {
>>>>>>>> > -        return new Class<?>[]{
>>>>>>>> > -            ArrayBlockingQueueFactory.class,
>>>>>>>> > -            DisruptorBlockingQueueFactory.class,
>>>>>>>> > -            LinkedTransferQueueFactory.class
>>>>>>>> > +        return new String[]{
>>>>>>>> > +            // default async config uses array blocking queue
>>>>>>>> > +            "log4j-asynch.xml",
>>>>>>>> > +            // override default blocking queue implementations
>>>>>>>> > +            "BlockingQueueFactory-ArrayBlockingQueue.xml",
>>>>>>>> > +            "BlockingQueueFactory-DisruptorBlockingQueue.xml",
>>>>>>>> > +            "BlockingQueueFactory-LinkedTransferQueue.xml"
>>>>>>>> >         };
>>>>>>>> >     }
>>>>>>>> >
>>>>>>>> > -    public AsyncAppenderTest(final Class<? extends
>>>>>>>> BlockingQueueFactory> factory) {
>>>>>>>> > -        context = new LoggerContextRule(CONFIG).with
>>>>>>>> SystemProperty(BlockingQueueFactory.PROPERTY, factory.getName());
>>>>>>>> > +    public AsyncAppenderTest(final String configFileName) {
>>>>>>>> > +        context = new LoggerContextRule(configFileName);
>>>>>>>> >     }
>>>>>>>> >
>>>>>>>> >     @Rule
>>>>>>>> >
>>>>>>>> > http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/6
>>>>>>>> 5ec9bce/log4j-core/src/test/resources/BlockingQueueFactory-A
>>>>>>>> rrayBlockingQueue.xml
>>>>>>>> > ------------------------------------------------------------
>>>>>>>> ----------
>>>>>>>> > diff --git a/log4j-core/src/test/resource
>>>>>>>> s/BlockingQueueFactory-ArrayBlockingQueue.xml
>>>>>>>> b/log4j-core/src/test/resources/BlockingQueueFactory-ArrayBl
>>>>>>>> ockingQueue.xml
>>>>>>>> > new file mode 100644
>>>>>>>> > index 0000000..e8bbfa6
>>>>>>>> > --- /dev/null
>>>>>>>> > +++ b/log4j-core/src/test/resources/BlockingQueueFactory-ArrayBl
>>>>>>>> ockingQueue.xml
>>>>>>>> > @@ -0,0 +1,40 @@
>>>>>>>> > +<?xml version="1.0" encoding="UTF-8"?>
>>>>>>>> > +<!--
>>>>>>>> > + 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.
>>>>>>>> > +
>>>>>>>> > +-->
>>>>>>>> > +<Configuration status="OFF" name="ArrayBlockingQueueFactory">
>>>>>>>> > +
>>>>>>>> > +  <Appenders>
>>>>>>>> > +    <Console name="STDOUT">
>>>>>>>> > +      <PatternLayout pattern="%m%n"/>
>>>>>>>> > +    </Console>
>>>>>>>> > +    <List name="List">
>>>>>>>> > +      <PatternLayout pattern="%C %M %m"/>
>>>>>>>> > +    </List>
>>>>>>>> > +    <Async name="Async" includeLocation="true"
>>>>>>>> error-ref="STDOUT">
>>>>>>>> > +      <AppenderRef ref="List"/>
>>>>>>>> > +      <ArrayBlockingQueue/>
>>>>>>>> > +    </Async>
>>>>>>>> > +  </Appenders>
>>>>>>>> > +
>>>>>>>> > +  <Loggers>
>>>>>>>> > +    <Root level="debug">
>>>>>>>> > +      <AppenderRef ref="Async"/>
>>>>>>>> > +    </Root>
>>>>>>>> > +  </Loggers>
>>>>>>>> > +
>>>>>>>> > +</Configuration>
>>>>>>>> > \ No newline at end of file
>>>>>>>> >
>>>>>>>> > http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/6
>>>>>>>> 5ec9bce/log4j-core/src/test/resources/BlockingQueueFactory-D
>>>>>>>> isruptorBlockingQueue.xml
>>>>>>>> > ------------------------------------------------------------
>>>>>>>> ----------
>>>>>>>> > diff --git a/log4j-core/src/test/resource
>>>>>>>> s/BlockingQueueFactory-DisruptorBlockingQueue.xml
>>>>>>>> b/log4j-core/src/test/resources/BlockingQueueFactory-Disrupt
>>>>>>>> orBlockingQueue.xml
>>>>>>>> > new file mode 100644
>>>>>>>> > index 0000000..268cca7
>>>>>>>> > --- /dev/null
>>>>>>>> > +++ b/log4j-core/src/test/resources/BlockingQueueFactory-Disrupt
>>>>>>>> orBlockingQueue.xml
>>>>>>>> > @@ -0,0 +1,40 @@
>>>>>>>> > +<?xml version="1.0" encoding="UTF-8"?>
>>>>>>>> > +<!--
>>>>>>>> > + 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.
>>>>>>>> > +
>>>>>>>> > +-->
>>>>>>>> > +<Configuration status="OFF" name="DisruptorBlockingQueueFa
>>>>>>>> ctory">
>>>>>>>> > +
>>>>>>>> > +  <Appenders>
>>>>>>>> > +    <Console name="STDOUT">
>>>>>>>> > +      <PatternLayout pattern="%m%n"/>
>>>>>>>> > +    </Console>
>>>>>>>> > +    <List name="List">
>>>>>>>> > +      <PatternLayout pattern="%C %M %m"/>
>>>>>>>> > +    </List>
>>>>>>>> > +    <Async name="Async" includeLocation="true"
>>>>>>>> error-ref="STDOUT">
>>>>>>>> > +      <AppenderRef ref="List"/>
>>>>>>>> > +      <DisruptorBlockingQueue/>
>>>>>>>> > +    </Async>
>>>>>>>> > +  </Appenders>
>>>>>>>> > +
>>>>>>>> > +  <Loggers>
>>>>>>>> > +    <Root level="debug">
>>>>>>>> > +      <AppenderRef ref="Async"/>
>>>>>>>> > +    </Root>
>>>>>>>> > +  </Loggers>
>>>>>>>> > +
>>>>>>>> > +</Configuration>
>>>>>>>> > \ No newline at end of file
>>>>>>>> >
>>>>>>>> > http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/6
>>>>>>>> 5ec9bce/log4j-core/src/test/resources/BlockingQueueFactory-L
>>>>>>>> inkedTransferQueue.xml
>>>>>>>> > ------------------------------------------------------------
>>>>>>>> ----------
>>>>>>>> > diff --git a/log4j-core/src/test/resource
>>>>>>>> s/BlockingQueueFactory-LinkedTransferQueue.xml
>>>>>>>> b/log4j-core/src/test/resources/BlockingQueueFactory-LinkedT
>>>>>>>> ransferQueue.xml
>>>>>>>> > new file mode 100644
>>>>>>>> > index 0000000..13063d3
>>>>>>>> > --- /dev/null
>>>>>>>> > +++ b/log4j-core/src/test/resources/BlockingQueueFactory-LinkedT
>>>>>>>> ransferQueue.xml
>>>>>>>> > @@ -0,0 +1,40 @@
>>>>>>>> > +<?xml version="1.0" encoding="UTF-8"?>
>>>>>>>> > +<!--
>>>>>>>> > + 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.
>>>>>>>> > +
>>>>>>>> > +-->
>>>>>>>> > +<Configuration status="OFF" name="LinkedTransferQueueFactory">
>>>>>>>> > +
>>>>>>>> > +  <Appenders>
>>>>>>>> > +    <Console name="STDOUT">
>>>>>>>> > +      <PatternLayout pattern="%m%n"/>
>>>>>>>> > +    </Console>
>>>>>>>> > +    <List name="List">
>>>>>>>> > +      <PatternLayout pattern="%C %M %m"/>
>>>>>>>> > +    </List>
>>>>>>>> > +    <Async name="Async" includeLocation="true"
>>>>>>>> error-ref="STDOUT">
>>>>>>>> > +      <AppenderRef ref="List"/>
>>>>>>>> > +      <LinkedTransferQueue/>
>>>>>>>> > +    </Async>
>>>>>>>> > +  </Appenders>
>>>>>>>> > +
>>>>>>>> > +  <Loggers>
>>>>>>>> > +    <Root level="debug">
>>>>>>>> > +      <AppenderRef ref="Async"/>
>>>>>>>> > +    </Root>
>>>>>>>> > +  </Loggers>
>>>>>>>> > +
>>>>>>>> > +</Configuration>
>>>>>>>> > \ No newline at end of file
>>>>>>>> >
>>>>>>>> >
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> ------------------------------------------------------------
>>>>>>>> ---------
>>>>>>>> To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
>>>>>>>> For additional commands, e-mail: log4j-dev-help@logging.apache.org
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> --
>>>>>>> E-Mail: garydgregory@gmail.com | ggregory@apache.org
>>>>>>> Java Persistence with Hibernate, Second Edition
>>>>>>> <http://www.manning.com/bauer3/>
>>>>>>> JUnit in Action, Second Edition <http://www.manning.com/tahchiev/>
>>>>>>> Spring Batch in Action <http://www.manning.com/templier/>
>>>>>>> Blog: http://garygregory.wordpress.com
>>>>>>> Home: http://garygregory.com/
>>>>>>> Tweet! http://twitter.com/GaryGregory
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>
>>>>>>
>>>>>> --
>>>>>> E-Mail: garydgregory@gmail.com | ggregory@apache.org
>>>>>> Java Persistence with Hibernate, Second Edition
>>>>>> <http://www.manning.com/bauer3/>
>>>>>> JUnit in Action, Second Edition <http://www.manning.com/tahchiev/>
>>>>>> Spring Batch in Action <http://www.manning.com/templier/>
>>>>>> Blog: http://garygregory.wordpress.com
>>>>>> Home: http://garygregory.com/
>>>>>> Tweet! http://twitter.com/GaryGregory
>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> Matt Sicker <boards@gmail.com>
>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> Matt Sicker <boards@gmail.com>
>>>>
>>>
>>>
>>
>>
>> --
>> Matt Sicker <boards@gmail.com>
>>
>
>
>
> --
> Matt Sicker <boards@gmail.com>
>
>
>


-- 
Matt Sicker <boards@gmail.com>

Mime
View raw message