accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From e..@apache.org
Subject [3/3] accumulo git commit: ACCUMULO-3919 fix-up warnings
Date Thu, 25 Jun 2015 14:41:08 GMT
ACCUMULO-3919 fix-up warnings


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

Branch: refs/heads/master
Commit: 3fba91d1edc151b90435e5a8ab14ef52e747a015
Parents: 0bd695c
Author: Eric Newton <eric.newton@gmail.com>
Authored: Thu Jun 25 10:39:00 2015 -0400
Committer: Eric Newton <eric.newton@gmail.com>
Committed: Thu Jun 25 10:39:00 2015 -0400

----------------------------------------------------------------------
 .../accumulo/server/util/SendLogToChainsaw.java |  4 +
 .../accumulo/tracer/AsyncSpanReceiverTest.java  | 87 ++++++++++----------
 .../test/TabletServerHdfsRestartIT.java         |  2 -
 3 files changed, 49 insertions(+), 44 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/accumulo/blob/3fba91d1/server/base/src/main/java/org/apache/accumulo/server/util/SendLogToChainsaw.java
----------------------------------------------------------------------
diff --git a/server/base/src/main/java/org/apache/accumulo/server/util/SendLogToChainsaw.java
b/server/base/src/main/java/org/apache/accumulo/server/util/SendLogToChainsaw.java
index c6f78bb..d441a58 100644
--- a/server/base/src/main/java/org/apache/accumulo/server/util/SendLogToChainsaw.java
+++ b/server/base/src/main/java/org/apache/accumulo/server/util/SendLogToChainsaw.java
@@ -128,6 +128,10 @@ public class SendLogToChainsaw extends XMLLayout {
         } catch (FileNotFoundException e) {
           System.out.println("Unable to find file: " + log.getAbsolutePath());
           throw e;
+        } finally {
+          if (isReader != null) {
+            isReader.close();
+          }
         }
         reader = new BufferedReader(isReader);
 

http://git-wip-us.apache.org/repos/asf/accumulo/blob/3fba91d1/server/tracer/src/test/java/org/apache/accumulo/tracer/AsyncSpanReceiverTest.java
----------------------------------------------------------------------
diff --git a/server/tracer/src/test/java/org/apache/accumulo/tracer/AsyncSpanReceiverTest.java
b/server/tracer/src/test/java/org/apache/accumulo/tracer/AsyncSpanReceiverTest.java
index e735373..f76d5c9 100644
--- a/server/tracer/src/test/java/org/apache/accumulo/tracer/AsyncSpanReceiverTest.java
+++ b/server/tracer/src/test/java/org/apache/accumulo/tracer/AsyncSpanReceiverTest.java
@@ -72,58 +72,61 @@ public class AsyncSpanReceiverTest {
 
   @Test
   public void test() throws InterruptedException {
-    TestReceiver receiver = new TestReceiver();
-
-    receiver.receiveSpan(createSpan(0));
-    while (receiver.getQueueSize() > 0) {
-      Thread.sleep(500);
-    }
-    assertEquals(0, receiver.getQueueSize());
-    assertEquals(0, receiver.getSpansSent());
-
-    receiver.receiveSpan(createSpan(1));
-    while (receiver.getQueueSize() > 0) {
-      Thread.sleep(500);
+    try (TestReceiver receiver = new TestReceiver()) {
+
+      receiver.receiveSpan(createSpan(0));
+      while (receiver.getQueueSize() > 0) {
+        Thread.sleep(500);
+      }
+      assertEquals(0, receiver.getQueueSize());
+      assertEquals(0, receiver.getSpansSent());
+
+      receiver.receiveSpan(createSpan(1));
+      while (receiver.getQueueSize() > 0) {
+        Thread.sleep(500);
+      }
+      assertEquals(0, receiver.getQueueSize());
+      assertEquals(1, receiver.getSpansSent());
     }
-    assertEquals(0, receiver.getQueueSize());
-    assertEquals(1, receiver.getSpansSent());
   }
 
   @Test
   public void testKeepAll() throws InterruptedException {
-    TestReceiver receiver = new TestReceiver(HTraceConfiguration.fromMap(Collections.singletonMap(AsyncSpanReceiver.SPAN_MIN_MS,
"0")));
-
-    receiver.receiveSpan(createSpan(0));
-    while (receiver.getQueueSize() > 0) {
-      Thread.sleep(500);
+    try( TestReceiver receiver = new TestReceiver(HTraceConfiguration.fromMap(Collections.singletonMap(AsyncSpanReceiver.SPAN_MIN_MS,
"0")))) {
+
+      receiver.receiveSpan(createSpan(0));
+      while (receiver.getQueueSize() > 0) {
+        Thread.sleep(500);
+      }
+      assertEquals(0, receiver.getQueueSize());
+      assertEquals(1, receiver.getSpansSent());
     }
-    assertEquals(0, receiver.getQueueSize());
-    assertEquals(1, receiver.getSpansSent());
   }
 
   @Test
   public void testExcludeMore() throws InterruptedException {
-    TestReceiver receiver = new TestReceiver(HTraceConfiguration.fromMap(Collections.singletonMap(AsyncSpanReceiver.SPAN_MIN_MS,
"10")));
-
-    receiver.receiveSpan(createSpan(0));
-    while (receiver.getQueueSize() > 0) {
-      Thread.sleep(500);
-    }
-    assertEquals(0, receiver.getQueueSize());
-    assertEquals(0, receiver.getSpansSent());
-
-    receiver.receiveSpan(createSpan(9));
-    while (receiver.getQueueSize() > 0) {
-      Thread.sleep(500);
-    }
-    assertEquals(0, receiver.getQueueSize());
-    assertEquals(0, receiver.getSpansSent());
-
-    receiver.receiveSpan(createSpan(10));
-    while (receiver.getQueueSize() > 0) {
-      Thread.sleep(500);
+    try (TestReceiver receiver = new TestReceiver(HTraceConfiguration.fromMap(Collections.singletonMap(AsyncSpanReceiver.SPAN_MIN_MS,
"10")))) {
+
+      receiver.receiveSpan(createSpan(0));
+      while (receiver.getQueueSize() > 0) {
+        Thread.sleep(500);
+      }
+      assertEquals(0, receiver.getQueueSize());
+      assertEquals(0, receiver.getSpansSent());
+
+      receiver.receiveSpan(createSpan(9));
+      while (receiver.getQueueSize() > 0) {
+        Thread.sleep(500);
+      }
+      assertEquals(0, receiver.getQueueSize());
+      assertEquals(0, receiver.getSpansSent());
+
+      receiver.receiveSpan(createSpan(10));
+      while (receiver.getQueueSize() > 0) {
+        Thread.sleep(500);
+      }
+      assertEquals(0, receiver.getQueueSize());
+      assertEquals(1, receiver.getSpansSent());
     }
-    assertEquals(0, receiver.getQueueSize());
-    assertEquals(1, receiver.getSpansSent());
   }
 }

http://git-wip-us.apache.org/repos/asf/accumulo/blob/3fba91d1/test/src/main/java/org/apache/accumulo/test/TabletServerHdfsRestartIT.java
----------------------------------------------------------------------
diff --git a/test/src/main/java/org/apache/accumulo/test/TabletServerHdfsRestartIT.java b/test/src/main/java/org/apache/accumulo/test/TabletServerHdfsRestartIT.java
index e48ffe8..e92c1c5 100644
--- a/test/src/main/java/org/apache/accumulo/test/TabletServerHdfsRestartIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/TabletServerHdfsRestartIT.java
@@ -20,7 +20,6 @@ import static org.junit.Assert.assertEquals;
 
 import org.apache.accumulo.core.client.BatchWriter;
 import org.apache.accumulo.core.client.Connector;
-import org.apache.accumulo.core.client.Scanner;
 import org.apache.accumulo.core.conf.Property;
 import org.apache.accumulo.core.data.Mutation;
 import org.apache.accumulo.core.security.Authorizations;
@@ -58,7 +57,6 @@ public class TabletServerHdfsRestartIT extends ConfigurableMacBase {
     }
     bw.close();
     conn.tableOperations().flush(tableName, null, null, true);
-    Scanner s = conn.createScanner(tableName, Authorizations.EMPTY);
 
     // Kill dfs
     cluster.getMiniDfs().restartNameNode(false);


Mime
View raw message