Repository: logging-log4j2 Updated Branches: refs/heads/master 0b085168f -> 9660677ff
LOG4J2-1278 removed old Unbox class from perf.nogc package Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/9660677f Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/9660677f Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/9660677f Branch: refs/heads/master Commit: 9660677ffccc3318c38f2c3f732436a75473a728 Parents: 0b08516 Author: rpopma <[email protected]> Authored: Sat Apr 2 13:19:59 2016 +0900 Committer: rpopma <[email protected]> Committed: Sat Apr 2 13:19:59 2016 +0900 ---------------------------------------------------------------------- .../log4j/perf/jmh/AsyncLoggersBenchmark.java | 1 - .../apache/logging/log4j/perf/nogc/Test.java | 3 +- .../apache/logging/log4j/perf/nogc/Unbox.java | 60 -------------------- 3 files changed, 2 insertions(+), 62 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/9660677f/log4j-perf/src/main/java/org/apache/logging/log4j/perf/jmh/AsyncLoggersBenchmark.java ---------------------------------------------------------------------- diff --git a/log4j-perf/src/main/java/org/apache/logging/log4j/perf/jmh/AsyncLoggersBenchmark.java b/log4j-perf/src/main/java/org/apache/logging/log4j/perf/jmh/AsyncLoggersBenchmark.java index 2d4eb9c..c1714e1 100644 --- a/log4j-perf/src/main/java/org/apache/logging/log4j/perf/jmh/AsyncLoggersBenchmark.java +++ b/log4j-perf/src/main/java/org/apache/logging/log4j/perf/jmh/AsyncLoggersBenchmark.java @@ -24,7 +24,6 @@ import java.util.concurrent.TimeUnit; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.apache.logging.log4j.core.LifeCycle; -import org.apache.logging.log4j.perf.nogc.Unbox; import org.openjdk.jmh.annotations.Benchmark; import org.openjdk.jmh.annotations.BenchmarkMode; import org.openjdk.jmh.annotations.Level; http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/9660677f/log4j-perf/src/main/java/org/apache/logging/log4j/perf/nogc/Test.java ---------------------------------------------------------------------- diff --git a/log4j-perf/src/main/java/org/apache/logging/log4j/perf/nogc/Test.java b/log4j-perf/src/main/java/org/apache/logging/log4j/perf/nogc/Test.java index a36ead2..f7b4169 100644 --- a/log4j-perf/src/main/java/org/apache/logging/log4j/perf/nogc/Test.java +++ b/log4j-perf/src/main/java/org/apache/logging/log4j/perf/nogc/Test.java @@ -17,7 +17,8 @@ package org.apache.logging.log4j.perf.nogc; import java.util.Date; -import static org.apache.logging.log4j.perf.nogc.Unbox.*; + +import static org.apache.logging.log4j.util.Unbox.*; /** * Tests the classic Log4j2 components. http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/9660677f/log4j-perf/src/main/java/org/apache/logging/log4j/perf/nogc/Unbox.java ---------------------------------------------------------------------- diff --git a/log4j-perf/src/main/java/org/apache/logging/log4j/perf/nogc/Unbox.java b/log4j-perf/src/main/java/org/apache/logging/log4j/perf/nogc/Unbox.java deleted file mode 100644 index 57a22fa..0000000 --- a/log4j-perf/src/main/java/org/apache/logging/log4j/perf/nogc/Unbox.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * 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.perf.nogc; - -/** - * Unbox class proposed in LOG4J2-1278.. - */ -public class Unbox { - // TODO make thread-safe with ThreadLocals - private static final StringBuilder[] ringbuffer; - private static int current; - private static final int MASK = 16 - 1; - - static { - ringbuffer = new StringBuilder[16]; - for (int i = 0; i < ringbuffer.length; i++) { - ringbuffer[i] = new StringBuilder(); - } - } - - public static StringBuilder box(float value) { - return getSB().append(value); - } - - public static StringBuilder box(double value) { - return getSB().append(value); - } - - public static StringBuilder box(short value) { - return getSB().append(value); - } - - public static StringBuilder box(int value) { - return getSB().append(value); - } - - public static StringBuilder box(long value) { - return getSB().append(value); - } - - private static StringBuilder getSB() { - StringBuilder result = ringbuffer[MASK & current++]; - result.setLength(0); - return result; - } -}
