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 <[email protected]> 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 <[email protected]> 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: <[email protected]> >> 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: [email protected] >> >> >> 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 <[email protected]> >> Authored: Sun Apr 5 16:00:17 2015 +0900 >> Committer: rpopma <[email protected]> >> 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: [email protected] | [email protected] >> 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 >
