HADOOP-11709. Time.NANOSECONDS_PER_MILLISECOND - use class-level final constant instead of method variable. Contributed by Ajith S.

This commit is contained in:
Tsuyoshi Ozawa 2015-03-21 00:54:20 +09:00
parent 8041267f02
commit 43dde502b3
2 changed files with 8 additions and 2 deletions

View File

@ -452,6 +452,9 @@ Release 2.8.0 - UNRELEASED
HADOOP-11659. o.a.h.fs.FileSystem.Cache#remove should use a single hash map
lookup. (Brahma Reddy Battula via aajisaka)
HADOOP-11709. Time.NANOSECONDS_PER_MILLISECOND - use class-level final
constant instead of method variable (Ajith S via ozawa)
OPTIMIZATIONS
BUG FIXES

View File

@ -27,6 +27,11 @@ import org.apache.hadoop.classification.InterfaceStability;
@InterfaceStability.Unstable
public final class Time {
/**
* number of nano seconds in 1 millisecond
*/
private static final long NANOSECONDS_PER_MILLISECOND = 1000000;
/**
* Current system time. Do not use this to calculate a duration or interval
* to sleep, because it will be broken by settimeofday. Instead, use
@ -45,8 +50,6 @@ public final class Time {
* @return a monotonic clock that counts in milliseconds.
*/
public static long monotonicNow() {
final long NANOSECONDS_PER_MILLISECOND = 1000000;
return System.nanoTime() / NANOSECONDS_PER_MILLISECOND;
}
}