logging-log4j-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gary Gregory <garydgreg...@gmail.com>
Subject Re: logging-log4j2 git commit: Make fairness configurable in ArrayBlockingQueueFactory
Date Sat, 18 Jun 2016 02:44:42 GMT
On Fri, Jun 17, 2016 at 7:17 PM, Remko Popma <remko.popma@gmail.com> wrote:

> If you don't mind, let's remove it until a user requests it. I hope I'm
> not being too negative here. :-)
>

Agreed. Thank you Matt for putting in the work but this one might fall in
the YAGNI category ;-)

Gary


> Sent from my iPhone
>
> On 2016/06/18, at 11:08, Matt Sicker <boards@gmail.com> wrote:
>
> Honestly, the only reason I added it here was because it's available. I do
> know that concurrency fairness is almost always the wrong thing to do,
> though. I can remove it.
>
> On 17 June 2016 at 20:50, Remko Popma <remko.popma@gmail.com> wrote:
>
>> Is there any reason to expose fairness as a user configurable parameter?
>>
>> The thing is that it sounds like a good thing (so users are likely to
>> switch it on) but actually hampers performance and in our case there's no
>> real reason to require fairness...
>>
>> Sent from my iPhone
>>
>> > On 2016/06/18, at 9:10, mattsicker@apache.org wrote:
>> >
>> > Repository: logging-log4j2
>> > Updated Branches:
>> >  refs/heads/feature/LOG4J2-1430 68e8ecb81 -> bf997fc10
>> >
>> >
>> > Make fairness configurable in ArrayBlockingQueueFactory
>> >
>> >
>> > Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo
>> > Commit:
>> http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/bf997fc1
>> > Tree:
>> http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/bf997fc1
>> > Diff:
>> http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/bf997fc1
>> >
>> > Branch: refs/heads/feature/LOG4J2-1430
>> > Commit: bf997fc1007e70a526bb20b6c90e63202c6f0886
>> > Parents: 68e8ecb
>> > Author: Matt Sicker <boards@gmail.com>
>> > Authored: Fri Jun 17 19:10:12 2016 -0500
>> > Committer: Matt Sicker <boards@gmail.com>
>> > Committed: Fri Jun 17 19:10:12 2016 -0500
>> >
>> > ----------------------------------------------------------------------
>> > .../log4j/core/async/ArrayBlockingQueueFactory.java   | 14
>> +++++++++++---
>> > 1 file changed, 11 insertions(+), 3 deletions(-)
>> > ----------------------------------------------------------------------
>> >
>> >
>> >
>> http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/bf997fc1/log4j-core/src/main/java/org/apache/logging/log4j/core/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/async/ArrayBlockingQueueFactory.java
>> > index dcad78a..ef1f05d 100644
>> > ---
>> 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/async/ArrayBlockingQueueFactory.java
>> > @@ -5,6 +5,7 @@ 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.PluginAttribute;
>> > import org.apache.logging.log4j.core.config.plugins.PluginFactory;
>> >
>> > /**
>> > @@ -14,13 +15,20 @@ import
>> org.apache.logging.log4j.core.config.plugins.PluginFactory;
>> >  */
>> > @Plugin(name = "ArrayBlockingQueue", category = Node.CATEGORY,
>> elementType = BlockingQueueFactory.ELEMENT_TYPE)
>> > public class ArrayBlockingQueueFactory<E> implements
>> BlockingQueueFactory<E> {
>> > +
>> > +    private final boolean fair;
>> > +
>> > +    private ArrayBlockingQueueFactory(final boolean fair) {
>> > +        this.fair = fair;
>> > +    }
>> > +
>> >     @Override
>> >     public BlockingQueue<E> create(int capacity) {
>> > -        return new ArrayBlockingQueue<>(capacity);
>> > +        return new ArrayBlockingQueue<>(capacity, fair);
>> >     }
>> >
>> >     @PluginFactory
>> > -    public static <E> ArrayBlockingQueueFactory<E> createFactory()
{
>> > -        return new ArrayBlockingQueueFactory<>();
>> > +    public static <E> ArrayBlockingQueueFactory<E>
>> createFactory(@PluginAttribute("fair") final boolean fair) {
>> > +        return new ArrayBlockingQueueFactory<>(fair);
>> >     }
>> > }
>> >
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: log4j-dev-unsubscribe@logging.apache.org
>> For additional commands, e-mail: log4j-dev-help@logging.apache.org
>>
>>
>
>
> --
> Matt Sicker <boards@gmail.com>
>
>


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

Mime
View raw message