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 2018/01/28 11:58:25 UTC
[09/10] logging-log4j2 git commit: LOG4J2-1883 created new package
core.time.internal and moved internal class FixedPreciseClock into it
LOG4J2-1883 created new package core.time.internal and moved internal class FixedPreciseClock into it
Project: http://git-wip-us.apache.org/repos/asf/logging-log4j2/repo
Commit: http://git-wip-us.apache.org/repos/asf/logging-log4j2/commit/87ad4878
Tree: http://git-wip-us.apache.org/repos/asf/logging-log4j2/tree/87ad4878
Diff: http://git-wip-us.apache.org/repos/asf/logging-log4j2/diff/87ad4878
Branch: refs/heads/master
Commit: 87ad4878102f3548a2e5bce9e5593a7ba27fa1e6
Parents: 7b01003
Author: rpopma <rp...@apache.org>
Authored: Sat Jan 27 19:46:07 2018 +0900
Committer: rpopma <rp...@apache.org>
Committed: Sun Jan 28 19:46:20 2018 +0900
----------------------------------------------------------------------
.../log4j/core/time/FixedPreciseClock.java | 62 -------------------
.../core/time/internal/FixedPreciseClock.java | 65 ++++++++++++++++++++
.../core/async/RingBufferLogEventTest.java | 2 +-
.../log4j/core/time/MutableInstantTest.java | 1 +
4 files changed, 67 insertions(+), 63 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/87ad4878/log4j-core/src/main/java/org/apache/logging/log4j/core/time/FixedPreciseClock.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/time/FixedPreciseClock.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/time/FixedPreciseClock.java
deleted file mode 100644
index 21edc80..0000000
--- a/log4j-core/src/main/java/org/apache/logging/log4j/core/time/FixedPreciseClock.java
+++ /dev/null
@@ -1,62 +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.core.time;
-
-/**
- * Implementation of the {@code PreciseClock} interface that always returns a fixed time value.
- * @since 2.11
- */
-public class FixedPreciseClock implements PreciseClock {
- private final long currentTimeMillis;
- private final int nanosOfMillisecond;
-
- /**
- * Constructs a {@code FixedPreciseClock} that always returns the epoch.
- */
- public FixedPreciseClock() {
- this(0);
- }
-
- /**
- * Constructs a {@code FixedPreciseClock} that always returns the specified time in milliseconds since the epoch.
- * @param currentTimeMillis milliseconds since the epoch
- */
- public FixedPreciseClock(final long currentTimeMillis) {
- this(currentTimeMillis, 0);
- }
-
- /**
- * Constructs a {@code FixedPreciseClock} that always returns the specified time in milliseconds since the epoch
- * and nanosecond of the millisecond.
- * @param currentTimeMillis milliseconds since the epoch
- * @param nanosOfMillisecond nanosecond of the specified millisecond
- */
- public FixedPreciseClock(final long currentTimeMillis, final int nanosOfMillisecond) {
- this.currentTimeMillis = currentTimeMillis;
- this.nanosOfMillisecond = nanosOfMillisecond;
- }
-
- @Override
- public void init(final MutableInstant instant) {
- instant.initFromEpochMilli(currentTimeMillis, nanosOfMillisecond);
- }
-
- @Override
- public long currentTimeMillis() {
- return currentTimeMillis;
- }
-}
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/87ad4878/log4j-core/src/main/java/org/apache/logging/log4j/core/time/internal/FixedPreciseClock.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/main/java/org/apache/logging/log4j/core/time/internal/FixedPreciseClock.java b/log4j-core/src/main/java/org/apache/logging/log4j/core/time/internal/FixedPreciseClock.java
new file mode 100644
index 0000000..868cdbe
--- /dev/null
+++ b/log4j-core/src/main/java/org/apache/logging/log4j/core/time/internal/FixedPreciseClock.java
@@ -0,0 +1,65 @@
+/*
+ * 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.core.time.internal;
+
+import org.apache.logging.log4j.core.time.MutableInstant;
+import org.apache.logging.log4j.core.time.PreciseClock;
+
+/**
+ * Implementation of the {@code PreciseClock} interface that always returns a fixed time value.
+ * @since 2.11
+ */
+public class FixedPreciseClock implements PreciseClock {
+ private final long currentTimeMillis;
+ private final int nanosOfMillisecond;
+
+ /**
+ * Constructs a {@code FixedPreciseClock} that always returns the epoch.
+ */
+ public FixedPreciseClock() {
+ this(0);
+ }
+
+ /**
+ * Constructs a {@code FixedPreciseClock} that always returns the specified time in milliseconds since the epoch.
+ * @param currentTimeMillis milliseconds since the epoch
+ */
+ public FixedPreciseClock(final long currentTimeMillis) {
+ this(currentTimeMillis, 0);
+ }
+
+ /**
+ * Constructs a {@code FixedPreciseClock} that always returns the specified time in milliseconds since the epoch
+ * and nanosecond of the millisecond.
+ * @param currentTimeMillis milliseconds since the epoch
+ * @param nanosOfMillisecond nanosecond of the specified millisecond
+ */
+ public FixedPreciseClock(final long currentTimeMillis, final int nanosOfMillisecond) {
+ this.currentTimeMillis = currentTimeMillis;
+ this.nanosOfMillisecond = nanosOfMillisecond;
+ }
+
+ @Override
+ public void init(final MutableInstant instant) {
+ instant.initFromEpochMilli(currentTimeMillis, nanosOfMillisecond);
+ }
+
+ @Override
+ public long currentTimeMillis() {
+ return currentTimeMillis;
+ }
+}
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/87ad4878/log4j-core/src/test/java/org/apache/logging/log4j/core/async/RingBufferLogEventTest.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/test/java/org/apache/logging/log4j/core/async/RingBufferLogEventTest.java b/log4j-core/src/test/java/org/apache/logging/log4j/core/async/RingBufferLogEventTest.java
index dfb0a35..e3920f7 100644
--- a/log4j-core/src/test/java/org/apache/logging/log4j/core/async/RingBufferLogEventTest.java
+++ b/log4j-core/src/test/java/org/apache/logging/log4j/core/async/RingBufferLogEventTest.java
@@ -31,7 +31,7 @@ import org.apache.logging.log4j.ThreadContext.ContextStack;
import org.apache.logging.log4j.categories.AsyncLoggers;
import org.apache.logging.log4j.core.LogEvent;
import org.apache.logging.log4j.core.util.DummyNanoClock;
-import org.apache.logging.log4j.core.time.FixedPreciseClock;
+import org.apache.logging.log4j.core.time.internal.FixedPreciseClock;
import org.apache.logging.log4j.util.FilteredObjectInputStream;
import org.apache.logging.log4j.util.StringMap;
import org.apache.logging.log4j.core.impl.ThrowableProxy;
http://git-wip-us.apache.org/repos/asf/logging-log4j2/blob/87ad4878/log4j-core/src/test/java/org/apache/logging/log4j/core/time/MutableInstantTest.java
----------------------------------------------------------------------
diff --git a/log4j-core/src/test/java/org/apache/logging/log4j/core/time/MutableInstantTest.java b/log4j-core/src/test/java/org/apache/logging/log4j/core/time/MutableInstantTest.java
index e18c35f..63d3138 100644
--- a/log4j-core/src/test/java/org/apache/logging/log4j/core/time/MutableInstantTest.java
+++ b/log4j-core/src/test/java/org/apache/logging/log4j/core/time/MutableInstantTest.java
@@ -16,6 +16,7 @@
*/
package org.apache.logging.log4j.core.time;
+import org.apache.logging.log4j.core.time.internal.FixedPreciseClock;
import org.junit.Test;
import static org.junit.Assert.assertEquals;