You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@logging.apache.org by rp...@apache.org on 2015/04/05 09:00:12 UTC

logging-log4j2 git commit: LOG4J2-980 Replaced Long.compare(long, 0) with Long.signum(long) in BurstFilter: the compare method needs Java7.

Repository: logging-log4j2
Updated Branches:
  refs/heads/master 4f9361914 -> eed00545a


LOG4J2-980 Replaced Long.compare(long,0) with Long.signum(long) in
BurstFilter: the compare method needs Java7.

Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo
Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/eed00545
Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/eed00545
Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/eed00545

Branch: refs/heads/master
Commit: eed00545ab0fb167c406469669b4f00534998fd4
Parents: 4f93619
Author: rpopma <rp...@apache.org>
Authored: Sun Apr 5 16:00:17 2015 +0900
Committer: rpopma <rp...@apache.org>
Committed: Sun Apr 5 16:00:17 2015 +0900

----------------------------------------------------------------------
 .../java/org/apache/logging/log4j/core/filter/BurstFilter.java     | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/eed00545/log4j-core/src/main/java/org/apache/logging/log4j/core/filter/BurstFilter.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/filter/BurstFilter.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/filter/BurstFilter.java
index f0ee65c..3658af0 100644
--- a/log4j-core/src/main/java/org/apache/logging/log4j/core/filter/BurstFilter.java
+++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/filter/BurstFilter.java
@@ -194,7 +194,7 @@ public final class BurstFilter extends AbstractFilter {
         @Override
         public int compareTo(final Delayed delayed) {
             final long diff = this.expireTime - ((LogDelay) delayed).expireTime;
-            return Long.compare(diff, 0);
+            return Long.signum(diff);
         }
 
         @Override


Re: logging-log4j2 git commit: LOG4J2-980 Replaced Long.compare(long, 0) with Long.signum(long) in BurstFilter: the compare method needs Java7.

Posted by Gary Gregory <ga...@gmail.com>.
Roger that!

G

On Sun, Apr 5, 2015 at 2:34 PM, Ralph Goers <ra...@dslextreme.com>
wrote:

> If you look at the release notes for the last release I added “Future
> releases may require a minimum of Java 7”.
>
> Ralph
>
>
> On Apr 5, 2015, at 2:01 PM, Gary Gregory <ga...@gmail.com> wrote:
>
> Hm, I think I might have done that, sorry. I wonder how long we want to
> keep Java 6 as the base platform...
>
> Gary
> ---------- Forwarded message ----------
> From: <rp...@apache.org>
> Date: Sun, Apr 5, 2015 at 12:00 AM
> Subject: logging-log4j2 git commit: LOG4J2-980 Replaced Long.compare(long,
> 0) with Long.signum(long) in BurstFilter: the compare method needs Java7.
> To: commits@logging.apache.org
>
>
> Repository: logging-log4j2
> Updated Branches:
>   refs/heads/master 4f9361914 -> eed00545a
>
>
> LOG4J2-980 Replaced Long.compare(long,0) with Long.signum(long) in
> BurstFilter: the compare method needs Java7.
>
> Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo
> Commit:
> http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/eed00545
> Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/eed00545
> Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/eed00545
>
> Branch: refs/heads/master
> Commit: eed00545ab0fb167c406469669b4f00534998fd4
> Parents: 4f93619
> Author: rpopma <rp...@apache.org>
> Authored: Sun Apr 5 16:00:17 2015 +0900
> Committer: rpopma <rp...@apache.org>
> Committed: Sun Apr 5 16:00:17 2015 +0900
>
> ----------------------------------------------------------------------
>  .../java/org/apache/logging/log4j/core/filter/BurstFilter.java     | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> ----------------------------------------------------------------------
>
>
>
> http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/eed00545/log4j-core/src/main/java/org/apache/logging/log4j/core/filter/BurstFilter.java
> ----------------------------------------------------------------------
> diff --git
> a/log4j-core/src/main/java/org/apache/logging/log4j/core/filter/BurstFilter.java
> b/log4j-core/src/main/java/org/apache/logging/log4j/core/filter/BurstFilter.java
> index f0ee65c..3658af0 100644
> ---
> a/log4j-core/src/main/java/org/apache/logging/log4j/core/filter/BurstFilter.java
> +++
> b/log4j-core/src/main/java/org/apache/logging/log4j/core/filter/BurstFilter.java
> @@ -194,7 +194,7 @@ public final class BurstFilter extends AbstractFilter {
>          @Override
>          public int compareTo(final Delayed delayed) {
>              final long diff = this.expireTime - ((LogDelay)
> delayed).expireTime;
> -            return Long.compare(diff, 0);
> +            return Long.signum(diff);
>          }
>
>          @Override
>
>
>
>
> --
> 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

Re: logging-log4j2 git commit: LOG4J2-980 Replaced Long.compare(long, 0) with Long.signum(long) in BurstFilter: the compare method needs Java7.

Posted by Remko Popma <re...@gmail.com>.
In this case signum() is actually the correct method to use: it was designed for this purpose, and (for the performance freaks) the JDK provides a branch-free implementation so the CPU pipeline is never stalled because of a branch misprediction here. 

Sent from my iPhone

> On 2015/04/06, at 6:34, Ralph Goers <ra...@dslextreme.com> wrote:
> 
> If you look at the release notes for the last release I added “Future releases may require a minimum of Java 7”.
> 
> Ralph
> 
> 
>> On Apr 5, 2015, at 2:01 PM, Gary Gregory <ga...@gmail.com> wrote:
>> 
>> Hm, I think I might have done that, sorry. I wonder how long we want to keep Java 6 as the base platform...
>> 
>> Gary
>> ---------- Forwarded message ----------
>> From: <rp...@apache.org>
>> Date: Sun, Apr 5, 2015 at 12:00 AM
>> Subject: logging-log4j2 git commit: LOG4J2-980 Replaced Long.compare(long, 0) with Long.signum(long) in BurstFilter: the compare method needs Java7.
>> To: commits@logging.apache.org
>> 
>> 
>> Repository: logging-log4j2
>> Updated Branches:
>>   refs/heads/master 4f9361914 -> eed00545a
>> 
>> 
>> LOG4J2-980 Replaced Long.compare(long,0) with Long.signum(long) in
>> BurstFilter: the compare method needs Java7.
>> 
>> Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo
>> Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/eed00545
>> Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/eed00545
>> Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/eed00545
>> 
>> Branch: refs/heads/master
>> Commit: eed00545ab0fb167c406469669b4f00534998fd4
>> Parents: 4f93619
>> Author: rpopma <rp...@apache.org>
>> Authored: Sun Apr 5 16:00:17 2015 +0900
>> Committer: rpopma <rp...@apache.org>
>> Committed: Sun Apr 5 16:00:17 2015 +0900
>> 
>> ----------------------------------------------------------------------
>>  .../java/org/apache/logging/log4j/core/filter/BurstFilter.java     | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>> ----------------------------------------------------------------------
>> 
>> 
>> http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/eed00545/log4j-core/src/main/java/org/apache/logging/log4j/core/filter/BurstFilter.java
>> ----------------------------------------------------------------------
>> diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/filter/BurstFilter.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/filter/BurstFilter.java
>> index f0ee65c..3658af0 100644
>> --- a/log4j-core/src/main/java/org/apache/logging/log4j/core/filter/BurstFilter.java
>> +++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/filter/BurstFilter.java
>> @@ -194,7 +194,7 @@ public final class BurstFilter extends AbstractFilter {
>>          @Override
>>          public int compareTo(final Delayed delayed) {
>>              final long diff = this.expireTime - ((LogDelay) delayed).expireTime;
>> -            return Long.compare(diff, 0);
>> +            return Long.signum(diff);
>>          }
>> 
>>          @Override
>> 
>> 
>> 
>> 
>> -- 
>> E-Mail: garydgregory@gmail.com | ggregory@apache.org 
>> Java Persistence with Hibernate, Second Edition
>> JUnit in Action, Second Edition
>> Spring Batch in Action
>> Blog: http://garygregory.wordpress.com 
>> Home: http://garygregory.com/
>> Tweet! http://twitter.com/GaryGregory
> 

Re: logging-log4j2 git commit: LOG4J2-980 Replaced Long.compare(long, 0) with Long.signum(long) in BurstFilter: the compare method needs Java7.

Posted by Ralph Goers <ra...@dslextreme.com>.
If you look at the release notes for the last release I added “Future releases may require a minimum of Java 7”.

Ralph


> On Apr 5, 2015, at 2:01 PM, Gary Gregory <ga...@gmail.com> wrote:
> 
> Hm, I think I might have done that, sorry. I wonder how long we want to keep Java 6 as the base platform...
> 
> Gary
> ---------- Forwarded message ----------
> From: <rpopma@apache.org <ma...@apache.org>>
> Date: Sun, Apr 5, 2015 at 12:00 AM
> Subject: logging-log4j2 git commit: LOG4J2-980 Replaced Long.compare(long, 0) with Long.signum(long) in BurstFilter: the compare method needs Java7.
> To: commits@logging.apache.org <ma...@logging.apache.org>
> 
> 
> Repository: logging-log4j2
> Updated Branches:
>   refs/heads/master 4f9361914 -> eed00545a
> 
> 
> LOG4J2-980 Replaced Long.compare(long,0) with Long.signum(long) in
> BurstFilter: the compare method needs Java7.
> 
> Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo <http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo>
> Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/eed00545 <http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/eed00545>
> Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/eed00545 <http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/eed00545>
> Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/eed00545 <http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/eed00545>
> 
> Branch: refs/heads/master
> Commit: eed00545ab0fb167c406469669b4f00534998fd4
> Parents: 4f93619
> Author: rpopma <rpopma@apache.org <ma...@apache.org>>
> Authored: Sun Apr 5 16:00:17 2015 +0900
> Committer: rpopma <rpopma@apache.org <ma...@apache.org>>
> Committed: Sun Apr 5 16:00:17 2015 +0900
> 
> ----------------------------------------------------------------------
>  .../java/org/apache/logging/log4j/core/filter/BurstFilter.java     | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> ----------------------------------------------------------------------
> 
> 
> http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/eed00545/log4j-core/src/main/java/org/apache/logging/log4j/core/filter/BurstFilter.java <http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/eed00545/log4j-core/src/main/java/org/apache/logging/log4j/core/filter/BurstFilter.java>
> ----------------------------------------------------------------------
> diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/filter/BurstFilter.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/filter/BurstFilter.java
> index f0ee65c..3658af0 100644
> --- a/log4j-core/src/main/java/org/apache/logging/log4j/core/filter/BurstFilter.java
> +++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/filter/BurstFilter.java
> @@ -194,7 +194,7 @@ public final class BurstFilter extends AbstractFilter {
>          @Override
>          public int compareTo(final Delayed delayed) {
>              final long diff = this.expireTime - ((LogDelay) delayed).expireTime;
> -            return Long.compare(diff, 0);
> +            return Long.signum(diff);
>          }
> 
>          @Override
> 
> 
> 
> 
> -- 
> E-Mail: garydgregory@gmail.com <ma...@gmail.com> | ggregory@apache.org  <ma...@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 <http://garygregory.wordpress.com/> 
> Home: http://garygregory.com/ <http://garygregory.com/>
> Tweet! http://twitter.com/GaryGregory <http://twitter.com/GaryGregory>

Fwd: logging-log4j2 git commit: LOG4J2-980 Replaced Long.compare(long, 0) with Long.signum(long) in BurstFilter: the compare method needs Java7.

Posted by Gary Gregory <ga...@gmail.com>.
Hm, I think I might have done that, sorry. I wonder how long we want to
keep Java 6 as the base platform...

Gary
---------- Forwarded message ----------
From: <rp...@apache.org>
Date: Sun, Apr 5, 2015 at 12:00 AM
Subject: logging-log4j2 git commit: LOG4J2-980 Replaced Long.compare(long,
0) with Long.signum(long) in BurstFilter: the compare method needs Java7.
To: commits@logging.apache.org


Repository: logging-log4j2
Updated Branches:
  refs/heads/master 4f9361914 -> eed00545a


LOG4J2-980 Replaced Long.compare(long,0) with Long.signum(long) in
BurstFilter: the compare method needs Java7.

Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo
Commit:
http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/eed00545
Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/eed00545
Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/eed00545

Branch: refs/heads/master
Commit: eed00545ab0fb167c406469669b4f00534998fd4
Parents: 4f93619
Author: rpopma <rp...@apache.org>
Authored: Sun Apr 5 16:00:17 2015 +0900
Committer: rpopma <rp...@apache.org>
Committed: Sun Apr 5 16:00:17 2015 +0900

----------------------------------------------------------------------
 .../java/org/apache/logging/log4j/core/filter/BurstFilter.java     | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/eed00545/log4j-core/src/main/java/org/apache/logging/log4j/core/filter/BurstFilter.java
----------------------------------------------------------------------
diff --git
a/log4j-core/src/main/java/org/apache/logging/log4j/core/filter/BurstFilter.java
b/log4j-core/src/main/java/org/apache/logging/log4j/core/filter/BurstFilter.java
index f0ee65c..3658af0 100644
---
a/log4j-core/src/main/java/org/apache/logging/log4j/core/filter/BurstFilter.java
+++
b/log4j-core/src/main/java/org/apache/logging/log4j/core/filter/BurstFilter.java
@@ -194,7 +194,7 @@ public final class BurstFilter extends AbstractFilter {
         @Override
         public int compareTo(final Delayed delayed) {
             final long diff = this.expireTime - ((LogDelay)
delayed).expireTime;
-            return Long.compare(diff, 0);
+            return Long.signum(diff);
         }

         @Override




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