From 63463be883ebb6a2140ee4f66faeb9629bad89ad Mon Sep 17 00:00:00 2001
From: boli <boli@localhost>
Date: Wed, 16 Jan 2008 23:19:50 +0000
Subject: [PATCH] This fix removes the option to use nanosecond etime resolution as a JVM property. It is now a global configuration attribute. Due to the 10% throughput decrease I saw when using System.nanoTime, the default still uses System.currentTimeMillis to timestamp operations. System.nanoTime will only be used when the ds-cfg-etime-resolution attribute is set to nano-seconds.

---
 opendj-sdk/opends/src/server/org/opends/server/util/TimeThread.java |   19 ++++++++++++++++++-
 1 files changed, 18 insertions(+), 1 deletions(-)

diff --git a/opendj-sdk/opends/src/server/org/opends/server/util/TimeThread.java b/opendj-sdk/opends/src/server/org/opends/server/util/TimeThread.java
index 27a311d..63e9c12 100644
--- a/opendj-sdk/opends/src/server/org/opends/server/util/TimeThread.java
+++ b/opendj-sdk/opends/src/server/org/opends/server/util/TimeThread.java
@@ -22,7 +22,7 @@
  * CDDL HEADER END
  *
  *
- *      Portions Copyright 2006-2007 Sun Microsystems, Inc.
+ *      Portions Copyright 2006-2008 Sun Microsystems, Inc.
  */
 package org.opends.server.util;
 
@@ -93,6 +93,9 @@
   // The current time in milliseconds since the epoch.
   private static volatile long time;
 
+  // The current time in nanoseconds.
+  private static volatile long nanoTime;
+
   // The date formatter that will be used to obtain the generalized time.
   private static SimpleDateFormat generalizedTimeFormatter;
 
@@ -139,6 +142,7 @@
     calendar        = new GregorianCalendar();
     date            = calendar.getTime();
     time            = date.getTime();
+    nanoTime        = System.nanoTime();
     generalizedTime = generalizedTimeFormatter.format(date);
     localTimestamp  = localTimestampFormatter.format(date);
     gmtTimestamp    = gmtTimestampFormatter.format(date);
@@ -163,6 +167,7 @@
         calendar        = new GregorianCalendar();
         date            = calendar.getTime();
         time            = date.getTime();
+        nanoTime        = System.nanoTime();
         generalizedTime = generalizedTimeFormatter.format(date);
         localTimestamp  = localTimestampFormatter.format(date);
         gmtTimestamp    = gmtTimestampFormatter.format(date);
@@ -223,6 +228,18 @@
     return time;
   }
 
+  /**
+   * Retrieves the time in nanoseconds from the most precise available system
+   * timer. The value retured represents nanoseconds since some fixed but
+   * arbitrary time.
+   *
+   * @return The time in nanoseconds from some fixed but arbitrary time.
+   */
+  public static long getNanoTime()
+  {
+    return nanoTime;
+  }
+
 
 
   /**

--
Gitblit v1.10.0