You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@accumulo.apache.org by ct...@apache.org on 2015/07/21 00:28:51 UTC

accumulo git commit: ACCUMULO-3840 Drop Closeable from OpTimer

Repository: accumulo
Updated Branches:
  refs/heads/master 6977629ed -> 430f3c699


ACCUMULO-3840 Drop Closeable from OpTimer

* Dropped unneeded Closeable interface from OpTimer. This eliminates unclosed
  resources warnings. We don't really need OpTimer to be Closeable. It doesn't
  have any resources to clean up and close() method doesn't add value,
  semantically, over stop(). If needed, we can add AutoCloseable in the future.
* Remove extra unused variable assignment from OpTimerTest


Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo
Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/430f3c69
Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/430f3c69
Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/430f3c69

Branch: refs/heads/master
Commit: 430f3c699369356065ef5a43cda122d0f01c2dda
Parents: 6977629
Author: Christopher Tubbs <ct...@apache.org>
Authored: Mon Jul 20 18:23:05 2015 -0400
Committer: Christopher Tubbs <ct...@apache.org>
Committed: Mon Jul 20 18:23:05 2015 -0400

----------------------------------------------------------------------
 .../java/org/apache/accumulo/core/util/OpTimer.java   | 12 +-----------
 .../org/apache/accumulo/core/util/OpTimerTest.java    | 14 ++++++--------
 2 files changed, 7 insertions(+), 19 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/accumulo/blob/430f3c69/core/src/main/java/org/apache/accumulo/core/util/OpTimer.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/util/OpTimer.java b/core/src/main/java/org/apache/accumulo/core/util/OpTimer.java
index 0ba7f8f..0fb8cc0 100644
--- a/core/src/main/java/org/apache/accumulo/core/util/OpTimer.java
+++ b/core/src/main/java/org/apache/accumulo/core/util/OpTimer.java
@@ -16,13 +16,12 @@
  */
 package org.apache.accumulo.core.util;
 
-import java.io.Closeable;
 import java.util.concurrent.TimeUnit;
 
 /**
  * Provides a stop watch for timing a single type of event. This code is based on the org.apache.hadoop.util.StopWatch available in hadoop 2.7.0
  */
-public class OpTimer implements Closeable {
+public class OpTimer {
 
   private boolean isStarted;
   private long startNanos;
@@ -129,13 +128,4 @@ public class OpTimer implements Closeable {
     return String.valueOf(now());
   }
 
-  /**
-   * If the timer is running, stop it. This method can be called even if the timer is not running.
-   */
-  @Override
-  public void close() {
-    if (isStarted) {
-      stop();
-    }
-  }
 }

http://git-wip-us.apache.org/repos/asf/accumulo/blob/430f3c69/core/src/test/java/org/apache/accumulo/core/util/OpTimerTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/accumulo/core/util/OpTimerTest.java b/core/src/test/java/org/apache/accumulo/core/util/OpTimerTest.java
index af87bf1..a824497 100644
--- a/core/src/test/java/org/apache/accumulo/core/util/OpTimerTest.java
+++ b/core/src/test/java/org/apache/accumulo/core/util/OpTimerTest.java
@@ -16,16 +16,16 @@
  */
 package org.apache.accumulo.core.util;
 
-import org.junit.Test;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.util.concurrent.TimeUnit;
-
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
 
+import java.util.concurrent.TimeUnit;
+
+import org.junit.Test;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
 /**
  * Exercise basic timer (org.apache.hadoop.util.StopWatch) functionality. Current usage requires ability to reset timer.
  */
@@ -193,8 +193,6 @@ public class OpTimerTest {
 
     long tValue = timer.now();
 
-    double millis = timer.scale(TimeUnit.MILLISECONDS);
-
     assertEquals(tValue / 1000000.0, timer.scale(TimeUnit.MILLISECONDS), 0.00000001);
 
     assertEquals(tValue / 1000000000.0, timer.scale(TimeUnit.SECONDS), 0.00000001);