You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@accumulo.apache.org by mw...@apache.org on 2019/02/25 15:14:15 UTC

[accumulo] branch master updated: Use try-with-resources for BatchWriter (#985)

This is an automated email from the ASF dual-hosted git repository.

mwalch pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/accumulo.git


The following commit(s) were added to refs/heads/master by this push:
     new c16928a  Use try-with-resources for BatchWriter (#985)
c16928a is described below

commit c16928a614f6c7e572c2df429aa81b60e0097e8e
Author: Mike Walch <mw...@apache.org>
AuthorDate: Mon Feb 25 10:14:10 2019 -0500

    Use try-with-resources for BatchWriter (#985)
    
    * No need to pass in default BatchWriterConfig
---
 .../org/apache/accumulo/test/AuditMessageIT.java   | 27 +++++------
 .../java/org/apache/accumulo/test/CleanWalIT.java  | 21 ++++----
 .../apache/accumulo/test/ClientSideIteratorIT.java |  5 +-
 .../java/org/apache/accumulo/test/CloneIT.java     |  5 +-
 .../accumulo/test/CompactionRateLimitingIT.java    |  3 +-
 .../apache/accumulo/test/ConditionalWriterIT.java  | 56 ++++++++++------------
 .../test/ConfigurableMajorCompactionIT.java        | 11 ++---
 .../org/apache/accumulo/test/ExistingMacIT.java    | 25 +++++-----
 .../java/org/apache/accumulo/test/FindMaxIT.java   |  3 +-
 .../org/apache/accumulo/test/ImportExportIT.java   | 16 +++----
 .../apache/accumulo/test/KeyValueEqualityIT.java   | 22 ++++-----
 .../accumulo/test/functional/AddSplitIT.java       | 24 ++++------
 .../test/functional/BadIteratorMincIT.java         | 23 ++++-----
 .../test/functional/BadLocalityGroupMincIT.java    | 12 ++---
 .../accumulo/test/functional/BatchScanSplitIT.java | 17 +++----
 .../test/functional/BatchWriterFlushIT.java        |  8 +---
 .../accumulo/test/functional/BloomFilterIT.java    | 43 ++++++++---------
 .../accumulo/test/functional/ClassLoaderIT.java    | 11 ++---
 .../accumulo/test/functional/CleanTmpIT.java       | 27 +++++------
 .../accumulo/test/functional/CombinerIT.java       | 14 +++---
 .../test/functional/ConcurrentDeleteTableIT.java   |  3 +-
 .../test/functional/ConfigurableCompactionIT.java  | 29 ++++++-----
 .../accumulo/test/functional/CreateAndUseIT.java   | 15 +++---
 .../accumulo/test/functional/DeleteRowsIT.java     | 16 +++----
 .../test/functional/DeleteRowsSplitIT.java         | 13 +++--
 .../test/functional/DeletedTablesDontFlushIT.java  |  8 ++--
 .../accumulo/test/functional/DurabilityIT.java     | 16 +++----
 .../test/functional/FateConcurrencyIT.java         | 17 ++++---
 .../test/functional/GarbageCollectorIT.java        | 45 +++++++++--------
 .../accumulo/test/functional/KerberosIT.java       | 47 +++++++++---------
 30 files changed, 259 insertions(+), 323 deletions(-)

diff --git a/test/src/main/java/org/apache/accumulo/test/AuditMessageIT.java b/test/src/main/java/org/apache/accumulo/test/AuditMessageIT.java
index 947b6a5..982fbcf 100644
--- a/test/src/main/java/org/apache/accumulo/test/AuditMessageIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/AuditMessageIT.java
@@ -34,7 +34,6 @@ import org.apache.accumulo.core.client.AccumuloException;
 import org.apache.accumulo.core.client.AccumuloSecurityException;
 import org.apache.accumulo.core.client.BatchScanner;
 import org.apache.accumulo.core.client.BatchWriter;
-import org.apache.accumulo.core.client.BatchWriterConfig;
 import org.apache.accumulo.core.client.Scanner;
 import org.apache.accumulo.core.client.TableExistsException;
 import org.apache.accumulo.core.client.TableNotFoundException;
@@ -303,13 +302,12 @@ public class AuditMessageIT extends ConfigurableMacBase {
     auditAccumuloClient.tableOperations().create(OLD_TEST_TABLE_NAME);
 
     // Insert some play data
-    BatchWriter bw = auditAccumuloClient.createBatchWriter(OLD_TEST_TABLE_NAME,
-        new BatchWriterConfig());
-    Mutation m = new Mutation("myRow");
-    m.put("cf1", "cq1", "v1");
-    m.put("cf1", "cq2", "v3");
-    bw.addMutation(m);
-    bw.close();
+    try (BatchWriter bw = auditAccumuloClient.createBatchWriter(OLD_TEST_TABLE_NAME)) {
+      Mutation m = new Mutation("myRow");
+      m.put("cf1", "cq1", "v1");
+      m.put("cf1", "cq2", "v3");
+      bw.addMutation(m);
+    }
 
     // Prepare to export the table
     File exportDir = new File(getCluster().getConfig().getDir() + "/export");
@@ -392,13 +390,12 @@ public class AuditMessageIT extends ConfigurableMacBase {
     auditAccumuloClient.tableOperations().create(OLD_TEST_TABLE_NAME);
 
     // Insert some play data
-    BatchWriter bw = auditAccumuloClient.createBatchWriter(OLD_TEST_TABLE_NAME,
-        new BatchWriterConfig());
-    Mutation m = new Mutation("myRow");
-    m.put("cf1", "cq1", "v1");
-    m.put("cf1", "cq2", "v3");
-    bw.addMutation(m);
-    bw.close();
+    try (BatchWriter bw = auditAccumuloClient.createBatchWriter(OLD_TEST_TABLE_NAME)) {
+      Mutation m = new Mutation("myRow");
+      m.put("cf1", "cq1", "v1");
+      m.put("cf1", "cq2", "v3");
+      bw.addMutation(m);
+    }
 
     // Start testing activities here
     // A regular scan
diff --git a/test/src/main/java/org/apache/accumulo/test/CleanWalIT.java b/test/src/main/java/org/apache/accumulo/test/CleanWalIT.java
index 37ab6be..9452efc 100644
--- a/test/src/main/java/org/apache/accumulo/test/CleanWalIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/CleanWalIT.java
@@ -24,7 +24,6 @@ import java.util.concurrent.TimeUnit;
 
 import org.apache.accumulo.core.client.AccumuloClient;
 import org.apache.accumulo.core.client.BatchWriter;
-import org.apache.accumulo.core.client.BatchWriterConfig;
 import org.apache.accumulo.core.client.Scanner;
 import org.apache.accumulo.core.client.TableNotFoundException;
 import org.apache.accumulo.core.conf.ClientProperty;
@@ -96,11 +95,11 @@ public class CleanWalIT extends AccumuloClusterHarness {
     try (AccumuloClient client = createAccumuloClient()) {
       String tableName = getUniqueNames(1)[0];
       client.tableOperations().create(tableName);
-      BatchWriter bw = client.createBatchWriter(tableName, new BatchWriterConfig());
-      Mutation m = new Mutation("row");
-      m.put("cf", "cq", "value");
-      bw.addMutation(m);
-      bw.close();
+      try (BatchWriter bw = client.createBatchWriter(tableName)) {
+        Mutation m = new Mutation("row");
+        m.put("cf", "cq", "value");
+        bw.addMutation(m);
+      }
       getCluster().getClusterControl().stopAllServers(ServerType.TABLET_SERVER);
       // all 3 tables should do recovery, but the bug doesn't really remove the log file references
 
@@ -115,11 +114,11 @@ public class CleanWalIT extends AccumuloClusterHarness {
         assertEquals("Found logs for " + table, 0, countLogs(client));
       }
 
-      bw = client.createBatchWriter(tableName, new BatchWriterConfig());
-      m = new Mutation("row");
-      m.putDelete("cf", "cq");
-      bw.addMutation(m);
-      bw.close();
+      try (BatchWriter bw = client.createBatchWriter(tableName)) {
+        Mutation m = new Mutation("row");
+        m.putDelete("cf", "cq");
+        bw.addMutation(m);
+      }
       assertEquals(0, count(tableName, client));
       client.tableOperations().flush(tableName, null, null, true);
       client.tableOperations().flush(MetadataTable.NAME, null, null, true);
diff --git a/test/src/main/java/org/apache/accumulo/test/ClientSideIteratorIT.java b/test/src/main/java/org/apache/accumulo/test/ClientSideIteratorIT.java
index 3569c60..fc5cfed 100644
--- a/test/src/main/java/org/apache/accumulo/test/ClientSideIteratorIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/ClientSideIteratorIT.java
@@ -26,7 +26,6 @@ import java.util.Map.Entry;
 
 import org.apache.accumulo.core.client.AccumuloClient;
 import org.apache.accumulo.core.client.BatchWriter;
-import org.apache.accumulo.core.client.BatchWriterConfig;
 import org.apache.accumulo.core.client.ClientSideIteratorScanner;
 import org.apache.accumulo.core.client.IteratorSetting;
 import org.apache.accumulo.core.client.Scanner;
@@ -89,7 +88,7 @@ public class ClientSideIteratorIT extends AccumuloClusterHarness {
   @Test
   public void testIntersect() throws Exception {
     client.tableOperations().create(tableName);
-    try (BatchWriter bw = client.createBatchWriter(tableName, new BatchWriterConfig())) {
+    try (BatchWriter bw = client.createBatchWriter(tableName)) {
       Mutation m = new Mutation("part1");
       m.put("bar", "doc1", "value");
       m.put("bar", "doc2", "value");
@@ -122,7 +121,7 @@ public class ClientSideIteratorIT extends AccumuloClusterHarness {
     client.tableOperations().removeProperty(tableName, "table.iterator.scan.vers");
     client.tableOperations().removeProperty(tableName, "table.iterator.majc.vers");
     client.tableOperations().removeProperty(tableName, "table.iterator.minc.vers");
-    try (BatchWriter bw = client.createBatchWriter(tableName, new BatchWriterConfig())) {
+    try (BatchWriter bw = client.createBatchWriter(tableName)) {
       Mutation m = new Mutation("row1");
       m.put("colf", "colq", 1L, "value");
       m.put("colf", "colq", 2L, "value");
diff --git a/test/src/main/java/org/apache/accumulo/test/CloneIT.java b/test/src/main/java/org/apache/accumulo/test/CloneIT.java
index 27ee913..a0f30b4 100644
--- a/test/src/main/java/org/apache/accumulo/test/CloneIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/CloneIT.java
@@ -25,7 +25,6 @@ import java.util.Map.Entry;
 
 import org.apache.accumulo.core.client.AccumuloClient;
 import org.apache.accumulo.core.client.BatchWriter;
-import org.apache.accumulo.core.client.BatchWriterConfig;
 import org.apache.accumulo.core.client.Scanner;
 import org.apache.accumulo.core.data.Key;
 import org.apache.accumulo.core.data.Mutation;
@@ -57,11 +56,11 @@ public class CloneIT extends AccumuloClusterHarness {
       TabletsSection.ServerColumnFamily.DIRECTORY_COLUMN.put(mut,
           new Value("/default_tablet".getBytes()));
 
-      try (BatchWriter bw1 = client.createBatchWriter(tableName, new BatchWriterConfig())) {
+      try (BatchWriter bw1 = client.createBatchWriter(tableName)) {
         bw1.addMutation(mut);
       }
 
-      try (BatchWriter bw2 = client.createBatchWriter(tableName, new BatchWriterConfig())) {
+      try (BatchWriter bw2 = client.createBatchWriter(tableName)) {
         MetadataTableUtil.initializeClone(tableName, TableId.of("0"), TableId.of("1"), client, bw2);
         int rc = MetadataTableUtil.checkClone(tableName, TableId.of("0"), TableId.of("1"), client,
             bw2);
diff --git a/test/src/main/java/org/apache/accumulo/test/CompactionRateLimitingIT.java b/test/src/main/java/org/apache/accumulo/test/CompactionRateLimitingIT.java
index 5e2e36c..478d36f 100644
--- a/test/src/main/java/org/apache/accumulo/test/CompactionRateLimitingIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/CompactionRateLimitingIT.java
@@ -23,7 +23,6 @@ import java.util.Random;
 
 import org.apache.accumulo.core.client.AccumuloClient;
 import org.apache.accumulo.core.client.BatchWriter;
-import org.apache.accumulo.core.client.BatchWriterConfig;
 import org.apache.accumulo.core.client.security.tokens.PasswordToken;
 import org.apache.accumulo.core.conf.Property;
 import org.apache.accumulo.core.data.Mutation;
@@ -50,7 +49,7 @@ public class CompactionRateLimitingIT extends ConfigurableMacBase {
     AccumuloClient client = getCluster().createAccumuloClient("root",
         new PasswordToken(ROOT_PASSWORD));
     client.tableOperations().create(tableName);
-    try (BatchWriter bw = client.createBatchWriter(tableName, new BatchWriterConfig())) {
+    try (BatchWriter bw = client.createBatchWriter(tableName)) {
       Random r = new SecureRandom();
       while (bytesWritten < BYTES_TO_WRITE) {
         byte[] rowKey = new byte[32];
diff --git a/test/src/main/java/org/apache/accumulo/test/ConditionalWriterIT.java b/test/src/main/java/org/apache/accumulo/test/ConditionalWriterIT.java
index f7d76c7..10e156e 100644
--- a/test/src/main/java/org/apache/accumulo/test/ConditionalWriterIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/ConditionalWriterIT.java
@@ -51,7 +51,6 @@ import org.apache.accumulo.core.client.AccumuloClient;
 import org.apache.accumulo.core.client.AccumuloException;
 import org.apache.accumulo.core.client.AccumuloSecurityException;
 import org.apache.accumulo.core.client.BatchWriter;
-import org.apache.accumulo.core.client.BatchWriterConfig;
 import org.apache.accumulo.core.client.ConditionalWriter;
 import org.apache.accumulo.core.client.ConditionalWriter.Result;
 import org.apache.accumulo.core.client.ConditionalWriter.Status;
@@ -502,25 +501,24 @@ public class ConditionalWriterIT extends AccumuloClusterHarness {
       client.tableOperations().create(tableName,
           new NewTableConfiguration().withoutDefaultIterators());
 
-      BatchWriter bw = client.createBatchWriter(tableName, new BatchWriterConfig());
+      try (BatchWriter bw = client.createBatchWriter(tableName)) {
 
-      Mutation m = new Mutation("ACCUMULO-1000");
-      m.put("count", "comments", "1");
-      bw.addMutation(m);
-      bw.addMutation(m);
-      bw.addMutation(m);
+        Mutation m = new Mutation("ACCUMULO-1000");
+        m.put("count", "comments", "1");
+        bw.addMutation(m);
+        bw.addMutation(m);
+        bw.addMutation(m);
 
-      m = new Mutation("ACCUMULO-1001");
-      m.put("count2", "comments", "1");
-      bw.addMutation(m);
-      bw.addMutation(m);
+        m = new Mutation("ACCUMULO-1001");
+        m.put("count2", "comments", "1");
+        bw.addMutation(m);
+        bw.addMutation(m);
 
-      m = new Mutation("ACCUMULO-1002");
-      m.put("count2", "comments", "1");
-      bw.addMutation(m);
-      bw.addMutation(m);
-
-      bw.close();
+        m = new Mutation("ACCUMULO-1002");
+        m.put("count2", "comments", "1");
+        bw.addMutation(m);
+        bw.addMutation(m);
+      }
 
       IteratorSetting iterConfig = new IteratorSetting(10, SummingCombiner.class);
       SummingCombiner.setEncodingType(iterConfig, Type.STRING);
@@ -658,21 +656,19 @@ public class ConditionalWriterIT extends AccumuloClusterHarness {
 
       client.tableOperations().create(tableName);
 
-      BatchWriter bw = client.createBatchWriter(tableName, new BatchWriterConfig());
-
-      Mutation m = new Mutation("ACCUMULO-1000");
-      m.put("count", "comments", "6");
-      bw.addMutation(m);
+      try (BatchWriter bw = client.createBatchWriter(tableName)) {
+        Mutation m = new Mutation("ACCUMULO-1000");
+        m.put("count", "comments", "6");
+        bw.addMutation(m);
 
-      m = new Mutation("ACCUMULO-1001");
-      m.put("count", "comments", "7");
-      bw.addMutation(m);
+        m = new Mutation("ACCUMULO-1001");
+        m.put("count", "comments", "7");
+        bw.addMutation(m);
 
-      m = new Mutation("ACCUMULO-1002");
-      m.put("count", "comments", "8");
-      bw.addMutation(m);
-
-      bw.close();
+        m = new Mutation("ACCUMULO-1002");
+        m.put("count", "comments", "8");
+        bw.addMutation(m);
+      }
 
       client.tableOperations().attachIterator(tableName, aiConfig1, EnumSet.of(IteratorScope.scan));
       client.tableOperations().offline(tableName, true);
diff --git a/test/src/main/java/org/apache/accumulo/test/ConfigurableMajorCompactionIT.java b/test/src/main/java/org/apache/accumulo/test/ConfigurableMajorCompactionIT.java
index a042af8..e8fb2e5 100644
--- a/test/src/main/java/org/apache/accumulo/test/ConfigurableMajorCompactionIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/ConfigurableMajorCompactionIT.java
@@ -24,7 +24,6 @@ import java.util.Map;
 
 import org.apache.accumulo.core.client.AccumuloClient;
 import org.apache.accumulo.core.client.BatchWriter;
-import org.apache.accumulo.core.client.BatchWriterConfig;
 import org.apache.accumulo.core.client.Scanner;
 import org.apache.accumulo.core.conf.Property;
 import org.apache.accumulo.core.data.Mutation;
@@ -110,11 +109,11 @@ public class ConfigurableMajorCompactionIT extends ConfigurableMacBase {
   }
 
   private void writeFile(AccumuloClient client, String tableName) throws Exception {
-    BatchWriter bw = client.createBatchWriter(tableName, new BatchWriterConfig());
-    Mutation m = new Mutation("row");
-    m.put("cf", "cq", "value");
-    bw.addMutation(m);
-    bw.close();
+    try (BatchWriter bw = client.createBatchWriter(tableName)) {
+      Mutation m = new Mutation("row");
+      m.put("cf", "cq", "value");
+      bw.addMutation(m);
+    }
     client.tableOperations().flush(tableName, null, null, true);
   }
 
diff --git a/test/src/main/java/org/apache/accumulo/test/ExistingMacIT.java b/test/src/main/java/org/apache/accumulo/test/ExistingMacIT.java
index 7268a0f..702ad57 100644
--- a/test/src/main/java/org/apache/accumulo/test/ExistingMacIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/ExistingMacIT.java
@@ -31,7 +31,6 @@ import java.util.Set;
 import org.apache.accumulo.core.Constants;
 import org.apache.accumulo.core.client.AccumuloClient;
 import org.apache.accumulo.core.client.BatchWriter;
-import org.apache.accumulo.core.client.BatchWriterConfig;
 import org.apache.accumulo.core.client.Scanner;
 import org.apache.accumulo.core.client.security.tokens.PasswordToken;
 import org.apache.accumulo.core.conf.ClientProperty;
@@ -92,14 +91,12 @@ public class ExistingMacIT extends ConfigurableMacBase {
 
     client.tableOperations().create("table1");
 
-    BatchWriter bw = client.createBatchWriter("table1", new BatchWriterConfig());
-
-    Mutation m1 = new Mutation("00081");
-    m1.put("math", "sqroot", "9");
-    m1.put("math", "sq", "6560");
-
-    bw.addMutation(m1);
-    bw.close();
+    try (BatchWriter bw = client.createBatchWriter("table1")) {
+      Mutation m1 = new Mutation("00081");
+      m1.put("math", "sqroot", "9");
+      m1.put("math", "sq", "6560");
+      bw.addMutation(m1);
+    }
 
     client.tableOperations().flush("table1", null, null, true);
     // TODO use constants
@@ -162,11 +159,11 @@ public class ExistingMacIT extends ConfigurableMacBase {
     try (AccumuloClient client = createClient()) {
       // Ensure that a master and tserver are up so the existing instance check won't fail.
       client.tableOperations().create(table);
-      BatchWriter bw = client.createBatchWriter(table, new BatchWriterConfig());
-      Mutation m = new Mutation("foo");
-      m.put("cf", "cq", "value");
-      bw.addMutation(m);
-      bw.close();
+      try (BatchWriter bw = client.createBatchWriter(table)) {
+        Mutation m = new Mutation("foo");
+        m.put("cf", "cq", "value");
+        bw.addMutation(m);
+      }
 
       File hadoopConfDir = createTestDir(ExistingMacIT.class.getSimpleName() + "_hadoop_conf_2");
       FileUtils.deleteQuietly(hadoopConfDir);
diff --git a/test/src/main/java/org/apache/accumulo/test/FindMaxIT.java b/test/src/main/java/org/apache/accumulo/test/FindMaxIT.java
index 60467eb..bab0afe 100644
--- a/test/src/main/java/org/apache/accumulo/test/FindMaxIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/FindMaxIT.java
@@ -24,7 +24,6 @@ import java.util.Map.Entry;
 
 import org.apache.accumulo.core.client.AccumuloClient;
 import org.apache.accumulo.core.client.BatchWriter;
-import org.apache.accumulo.core.client.BatchWriterConfig;
 import org.apache.accumulo.core.client.Scanner;
 import org.apache.accumulo.core.data.Key;
 import org.apache.accumulo.core.data.Mutation;
@@ -55,7 +54,7 @@ public class FindMaxIT extends AccumuloClusterHarness {
 
       client.tableOperations().create(tableName);
 
-      try (BatchWriter bw = client.createBatchWriter(tableName, new BatchWriterConfig())) {
+      try (BatchWriter bw = client.createBatchWriter(tableName)) {
         bw.addMutation(nm(new byte[] {0}));
         bw.addMutation(nm(new byte[] {0, 0}));
         bw.addMutation(nm(new byte[] {0, 1}));
diff --git a/test/src/main/java/org/apache/accumulo/test/ImportExportIT.java b/test/src/main/java/org/apache/accumulo/test/ImportExportIT.java
index 2e94079..188dbda 100644
--- a/test/src/main/java/org/apache/accumulo/test/ImportExportIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/ImportExportIT.java
@@ -31,7 +31,6 @@ import java.util.Map.Entry;
 import org.apache.accumulo.core.Constants;
 import org.apache.accumulo.core.client.AccumuloClient;
 import org.apache.accumulo.core.client.BatchWriter;
-import org.apache.accumulo.core.client.BatchWriterConfig;
 import org.apache.accumulo.core.client.Scanner;
 import org.apache.accumulo.core.data.Key;
 import org.apache.accumulo.core.data.Mutation;
@@ -75,17 +74,16 @@ public class ImportExportIT extends AccumuloClusterHarness {
       String srcTable = tableNames[0], destTable = tableNames[1];
       client.tableOperations().create(srcTable);
 
-      BatchWriter bw = client.createBatchWriter(srcTable, new BatchWriterConfig());
-      for (int row = 0; row < 1000; row++) {
-        Mutation m = new Mutation(Integer.toString(row));
-        for (int col = 0; col < 100; col++) {
-          m.put(Integer.toString(col), "", Integer.toString(col * 2));
+      try (BatchWriter bw = client.createBatchWriter(srcTable)) {
+        for (int row = 0; row < 1000; row++) {
+          Mutation m = new Mutation(Integer.toString(row));
+          for (int col = 0; col < 100; col++) {
+            m.put(Integer.toString(col), "", Integer.toString(col * 2));
+          }
+          bw.addMutation(m);
         }
-        bw.addMutation(m);
       }
 
-      bw.close();
-
       client.tableOperations().compact(srcTable, null, null, true, true);
 
       // Make a directory we can use to throw the export and import directories
diff --git a/test/src/main/java/org/apache/accumulo/test/KeyValueEqualityIT.java b/test/src/main/java/org/apache/accumulo/test/KeyValueEqualityIT.java
index 6a5b042..f299e6c 100644
--- a/test/src/main/java/org/apache/accumulo/test/KeyValueEqualityIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/KeyValueEqualityIT.java
@@ -24,7 +24,6 @@ import java.util.Map.Entry;
 
 import org.apache.accumulo.core.client.AccumuloClient;
 import org.apache.accumulo.core.client.BatchWriter;
-import org.apache.accumulo.core.client.BatchWriterConfig;
 import org.apache.accumulo.core.client.admin.TableOperations;
 import org.apache.accumulo.core.data.Key;
 import org.apache.accumulo.core.data.Mutation;
@@ -43,7 +42,6 @@ public class KeyValueEqualityIT extends AccumuloClusterHarness {
   @Test
   public void testEquality() throws Exception {
     try (AccumuloClient client = createAccumuloClient()) {
-      final BatchWriterConfig config = new BatchWriterConfig();
 
       final String[] tables = getUniqueNames(2);
       final String table1 = tables[0], table2 = tables[1];
@@ -51,21 +49,19 @@ public class KeyValueEqualityIT extends AccumuloClusterHarness {
       tops.create(table1);
       tops.create(table2);
 
-      final BatchWriter bw1 = client.createBatchWriter(table1, config),
-          bw2 = client.createBatchWriter(table2, config);
+      try (BatchWriter bw1 = client.createBatchWriter(table1);
+          BatchWriter bw2 = client.createBatchWriter(table2)) {
 
-      for (int row = 0; row < 100; row++) {
-        Mutation m = new Mutation(Integer.toString(row));
-        for (int col = 0; col < 10; col++) {
-          m.put(Integer.toString(col), "", System.currentTimeMillis(), Integer.toString(col * 2));
+        for (int row = 0; row < 100; row++) {
+          Mutation m = new Mutation(Integer.toString(row));
+          for (int col = 0; col < 10; col++) {
+            m.put(Integer.toString(col), "", System.currentTimeMillis(), Integer.toString(col * 2));
+          }
+          bw1.addMutation(m);
+          bw2.addMutation(m);
         }
-        bw1.addMutation(m);
-        bw2.addMutation(m);
       }
 
-      bw1.close();
-      bw2.close();
-
       Iterator<Entry<Key,Value>> t1 = client.createScanner(table1, Authorizations.EMPTY).iterator(),
           t2 = client.createScanner(table2, Authorizations.EMPTY).iterator();
       while (t1.hasNext() && t2.hasNext()) {
diff --git a/test/src/main/java/org/apache/accumulo/test/functional/AddSplitIT.java b/test/src/main/java/org/apache/accumulo/test/functional/AddSplitIT.java
index 50e7ad3..7ee3e3c 100644
--- a/test/src/main/java/org/apache/accumulo/test/functional/AddSplitIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/functional/AddSplitIT.java
@@ -26,11 +26,8 @@ import java.util.TreeSet;
 import java.util.concurrent.TimeUnit;
 
 import org.apache.accumulo.core.client.AccumuloClient;
-import org.apache.accumulo.core.client.AccumuloException;
 import org.apache.accumulo.core.client.BatchWriter;
-import org.apache.accumulo.core.client.MutationsRejectedException;
 import org.apache.accumulo.core.client.Scanner;
-import org.apache.accumulo.core.client.TableNotFoundException;
 import org.apache.accumulo.core.data.Key;
 import org.apache.accumulo.core.data.Mutation;
 import org.apache.accumulo.core.data.Value;
@@ -126,19 +123,14 @@ public class AddSplitIT extends AccumuloClusterHarness {
     }
   }
 
-  private void insertData(AccumuloClient client, String tableName, long ts)
-      throws AccumuloException, TableNotFoundException, MutationsRejectedException {
-    BatchWriter bw = client.createBatchWriter(tableName, null);
-
-    for (int i = 0; i < 10000; i++) {
-      String row = String.format("%09d", i);
-
-      Mutation m = new Mutation(new Text(row));
-      m.put(new Text("cf1"), new Text("cq1"), ts, new Value(Integer.toString(i).getBytes(UTF_8)));
-      bw.addMutation(m);
+  private void insertData(AccumuloClient client, String tableName, long ts) throws Exception {
+    try (BatchWriter bw = client.createBatchWriter(tableName)) {
+      for (int i = 0; i < 10000; i++) {
+        String row = String.format("%09d", i);
+        Mutation m = new Mutation(new Text(row));
+        m.put(new Text("cf1"), new Text("cq1"), ts, new Value(Integer.toString(i).getBytes(UTF_8)));
+        bw.addMutation(m);
+      }
     }
-
-    bw.close();
   }
-
 }
diff --git a/test/src/main/java/org/apache/accumulo/test/functional/BadIteratorMincIT.java b/test/src/main/java/org/apache/accumulo/test/functional/BadIteratorMincIT.java
index 3b83086..08b176e 100644
--- a/test/src/main/java/org/apache/accumulo/test/functional/BadIteratorMincIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/functional/BadIteratorMincIT.java
@@ -25,7 +25,6 @@ import java.util.concurrent.TimeUnit;
 
 import org.apache.accumulo.core.client.AccumuloClient;
 import org.apache.accumulo.core.client.BatchWriter;
-import org.apache.accumulo.core.client.BatchWriterConfig;
 import org.apache.accumulo.core.client.IteratorSetting;
 import org.apache.accumulo.core.client.Scanner;
 import org.apache.accumulo.core.data.Mutation;
@@ -53,13 +52,11 @@ public class BadIteratorMincIT extends AccumuloClusterHarness {
       c.tableOperations().create(tableName);
       IteratorSetting is = new IteratorSetting(30, BadIterator.class);
       c.tableOperations().attachIterator(tableName, is, EnumSet.of(IteratorScope.minc));
-      BatchWriter bw = c.createBatchWriter(tableName, new BatchWriterConfig());
-
-      Mutation m = new Mutation(new Text("r1"));
-      m.put(new Text("acf"), new Text(tableName), new Value("1".getBytes(UTF_8)));
-
-      bw.addMutation(m);
-      bw.close();
+      try (BatchWriter bw = c.createBatchWriter(tableName)) {
+        Mutation m = new Mutation(new Text("r1"));
+        m.put(new Text("acf"), new Text(tableName), new Value("1".getBytes(UTF_8)));
+        bw.addMutation(m);
+      }
 
       c.tableOperations().flush(tableName, null, null, false);
       sleepUninterruptibly(1, TimeUnit.SECONDS);
@@ -88,11 +85,11 @@ public class BadIteratorMincIT extends AccumuloClusterHarness {
 
         // now try putting bad iterator back and deleting the table
         c.tableOperations().attachIterator(tableName, is, EnumSet.of(IteratorScope.minc));
-        bw = c.createBatchWriter(tableName, new BatchWriterConfig());
-        m = new Mutation(new Text("r2"));
-        m.put(new Text("acf"), new Text(tableName), new Value("1".getBytes(UTF_8)));
-        bw.addMutation(m);
-        bw.close();
+        try (BatchWriter bw = c.createBatchWriter(tableName)) {
+          Mutation m = new Mutation(new Text("r2"));
+          m.put(new Text("acf"), new Text(tableName), new Value("1".getBytes(UTF_8)));
+          bw.addMutation(m);
+        }
 
         // make sure property is given time to propagate
         sleepUninterruptibly(500, TimeUnit.MILLISECONDS);
diff --git a/test/src/main/java/org/apache/accumulo/test/functional/BadLocalityGroupMincIT.java b/test/src/main/java/org/apache/accumulo/test/functional/BadLocalityGroupMincIT.java
index 8218f62..e47fd66 100644
--- a/test/src/main/java/org/apache/accumulo/test/functional/BadLocalityGroupMincIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/functional/BadLocalityGroupMincIT.java
@@ -23,7 +23,6 @@ import java.util.Map.Entry;
 
 import org.apache.accumulo.core.client.AccumuloClient;
 import org.apache.accumulo.core.client.BatchWriter;
-import org.apache.accumulo.core.client.BatchWriterConfig;
 import org.apache.accumulo.core.client.Scanner;
 import org.apache.accumulo.core.conf.Property;
 import org.apache.accumulo.core.data.Key;
@@ -61,12 +60,11 @@ public class BadLocalityGroupMincIT extends AccumuloClusterHarness {
       c.tableOperations().offline(tableName, true);
       c.tableOperations().online(tableName, true);
 
-      BatchWriter bw = c.createBatchWriter(tableName, new BatchWriterConfig());
-      Mutation m = new Mutation(new Text("r1"));
-      m.put(new Text("acf"), new Text(tableName), new Value("1".getBytes(UTF_8)));
-
-      bw.addMutation(m);
-      bw.close();
+      try (BatchWriter bw = c.createBatchWriter(tableName)) {
+        Mutation m = new Mutation(new Text("r1"));
+        m.put(new Text("acf"), new Text(tableName), new Value("1".getBytes(UTF_8)));
+        bw.addMutation(m);
+      }
 
       FunctionalTestUtils.checkRFiles(c, tableName, 1, 1, 0, 0);
 
diff --git a/test/src/main/java/org/apache/accumulo/test/functional/BatchScanSplitIT.java b/test/src/main/java/org/apache/accumulo/test/functional/BatchScanSplitIT.java
index bfe0bb3..37b7530 100644
--- a/test/src/main/java/org/apache/accumulo/test/functional/BatchScanSplitIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/functional/BatchScanSplitIT.java
@@ -30,7 +30,6 @@ import java.util.concurrent.TimeUnit;
 import org.apache.accumulo.core.client.AccumuloClient;
 import org.apache.accumulo.core.client.BatchScanner;
 import org.apache.accumulo.core.client.BatchWriter;
-import org.apache.accumulo.core.client.BatchWriterConfig;
 import org.apache.accumulo.core.conf.Property;
 import org.apache.accumulo.core.data.Key;
 import org.apache.accumulo.core.data.Mutation;
@@ -66,17 +65,15 @@ public class BatchScanSplitIT extends AccumuloClusterHarness {
 
       int numRows = 1 << 18;
 
-      BatchWriter bw = c.createBatchWriter(tableName, new BatchWriterConfig());
-
-      for (int i = 0; i < numRows; i++) {
-        Mutation m = new Mutation(new Text(String.format("%09x", i)));
-        m.put(new Text("cf1"), new Text("cq1"),
-            new Value(String.format("%016x", numRows - i).getBytes(UTF_8)));
-        bw.addMutation(m);
+      try (BatchWriter bw = c.createBatchWriter(tableName)) {
+        for (int i = 0; i < numRows; i++) {
+          Mutation m = new Mutation(new Text(String.format("%09x", i)));
+          m.put(new Text("cf1"), new Text("cq1"),
+              new Value(String.format("%016x", numRows - i).getBytes(UTF_8)));
+          bw.addMutation(m);
+        }
       }
 
-      bw.close();
-
       c.tableOperations().flush(tableName, null, null, true);
 
       c.tableOperations().setProperty(tableName, Property.TABLE_SPLIT_THRESHOLD.getKey(), "4K");
diff --git a/test/src/main/java/org/apache/accumulo/test/functional/BatchWriterFlushIT.java b/test/src/main/java/org/apache/accumulo/test/functional/BatchWriterFlushIT.java
index aa05064..bd3a3d3 100644
--- a/test/src/main/java/org/apache/accumulo/test/functional/BatchWriterFlushIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/functional/BatchWriterFlushIT.java
@@ -36,13 +36,10 @@ import java.util.TreeSet;
 import java.util.concurrent.TimeUnit;
 
 import org.apache.accumulo.core.client.AccumuloClient;
-import org.apache.accumulo.core.client.AccumuloException;
-import org.apache.accumulo.core.client.AccumuloSecurityException;
 import org.apache.accumulo.core.client.BatchWriter;
 import org.apache.accumulo.core.client.BatchWriterConfig;
 import org.apache.accumulo.core.client.MutationsRejectedException;
 import org.apache.accumulo.core.client.Scanner;
-import org.apache.accumulo.core.client.TableNotFoundException;
 import org.apache.accumulo.core.data.Key;
 import org.apache.accumulo.core.data.Mutation;
 import org.apache.accumulo.core.data.Range;
@@ -107,9 +104,8 @@ public class BatchWriterFlushIT extends AccumuloClusterHarness {
     }
   }
 
-  private void runFlushTest(AccumuloClient client, String tableName) throws AccumuloException,
-      AccumuloSecurityException, TableNotFoundException, MutationsRejectedException, Exception {
-    BatchWriter bw = client.createBatchWriter(tableName, new BatchWriterConfig());
+  private void runFlushTest(AccumuloClient client, String tableName) throws Exception {
+    BatchWriter bw = client.createBatchWriter(tableName);
     try (Scanner scanner = client.createScanner(tableName, Authorizations.EMPTY)) {
       Random r = new SecureRandom();
 
diff --git a/test/src/main/java/org/apache/accumulo/test/functional/BloomFilterIT.java b/test/src/main/java/org/apache/accumulo/test/functional/BloomFilterIT.java
index 42f64cf..e329fa4 100644
--- a/test/src/main/java/org/apache/accumulo/test/functional/BloomFilterIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/functional/BloomFilterIT.java
@@ -237,33 +237,28 @@ public class BloomFilterIT extends AccumuloClusterHarness {
   private void write(AccumuloClient c, String table, int depth, long start, long end, int step)
       throws Exception {
 
-    BatchWriter bw = c.createBatchWriter(table, new BatchWriterConfig());
-
-    for (long i = start; i < end; i += step) {
-      String key = String.format("k_%010d", i);
-
-      Mutation m = null;
-
-      switch (depth) {
-        case 1:
-          m = new Mutation(new Text(key));
-          m.put(new Text("cf"), new Text("cq"), new Value(("" + i).getBytes()));
-          break;
-        case 2:
-          m = new Mutation(new Text("row"));
-          m.put(new Text(key), new Text("cq"), new Value(("" + i).getBytes()));
-          break;
-        case 3:
-          m = new Mutation(new Text("row"));
-          m.put(new Text("cf"), new Text(key), new Value(("" + i).getBytes()));
-          break;
+    try (BatchWriter bw = c.createBatchWriter(table)) {
+      for (long i = start; i < end; i += step) {
+        String key = String.format("k_%010d", i);
+        Mutation m = null;
+        switch (depth) {
+          case 1:
+            m = new Mutation(new Text(key));
+            m.put(new Text("cf"), new Text("cq"), new Value(("" + i).getBytes()));
+            break;
+          case 2:
+            m = new Mutation(new Text("row"));
+            m.put(new Text(key), new Text("cq"), new Value(("" + i).getBytes()));
+            break;
+          case 3:
+            m = new Mutation(new Text("row"));
+            m.put(new Text("cf"), new Text(key), new Value(("" + i).getBytes()));
+            break;
+        }
+        bw.addMutation(m);
       }
-
-      bw.addMutation(m);
     }
 
-    bw.close();
-
     c.tableOperations().flush(table, null, null, true);
   }
 }
diff --git a/test/src/main/java/org/apache/accumulo/test/functional/ClassLoaderIT.java b/test/src/main/java/org/apache/accumulo/test/functional/ClassLoaderIT.java
index 8cec420..c10a7cf 100644
--- a/test/src/main/java/org/apache/accumulo/test/functional/ClassLoaderIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/functional/ClassLoaderIT.java
@@ -31,7 +31,6 @@ import java.util.concurrent.TimeUnit;
 
 import org.apache.accumulo.core.client.AccumuloClient;
 import org.apache.accumulo.core.client.BatchWriter;
-import org.apache.accumulo.core.client.BatchWriterConfig;
 import org.apache.accumulo.core.client.IteratorSetting;
 import org.apache.accumulo.core.client.Scanner;
 import org.apache.accumulo.core.data.Key;
@@ -91,11 +90,11 @@ public class ClassLoaderIT extends AccumuloClusterHarness {
     try (AccumuloClient c = createAccumuloClient()) {
       String tableName = getUniqueNames(1)[0];
       c.tableOperations().create(tableName);
-      BatchWriter bw = c.createBatchWriter(tableName, new BatchWriterConfig());
-      Mutation m = new Mutation("row1");
-      m.put("cf", "col1", "Test");
-      bw.addMutation(m);
-      bw.close();
+      try (BatchWriter bw = c.createBatchWriter(tableName)) {
+        Mutation m = new Mutation("row1");
+        m.put("cf", "col1", "Test");
+        bw.addMutation(m);
+      }
       scanCheck(c, tableName, "Test");
       FileSystem fs = getCluster().getFileSystem();
       Path jarPath = new Path(rootPath + "/lib/ext/Test.jar");
diff --git a/test/src/main/java/org/apache/accumulo/test/functional/CleanTmpIT.java b/test/src/main/java/org/apache/accumulo/test/functional/CleanTmpIT.java
index f8f3f75..5d9eb71 100644
--- a/test/src/main/java/org/apache/accumulo/test/functional/CleanTmpIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/functional/CleanTmpIT.java
@@ -25,7 +25,6 @@ import java.util.Map.Entry;
 
 import org.apache.accumulo.core.client.AccumuloClient;
 import org.apache.accumulo.core.client.BatchWriter;
-import org.apache.accumulo.core.client.BatchWriterConfig;
 import org.apache.accumulo.core.client.Scanner;
 import org.apache.accumulo.core.conf.Property;
 import org.apache.accumulo.core.data.Key;
@@ -70,20 +69,18 @@ public class CleanTmpIT extends ConfigurableMacBase {
       String tableName = getUniqueNames(1)[0];
       c.tableOperations().create(tableName);
       // write to it
-      BatchWriter bw = c.createBatchWriter(tableName, new BatchWriterConfig());
-      Mutation m = new Mutation("row");
-      m.put("cf", "cq", "value");
-      bw.addMutation(m);
-      bw.flush();
-
-      // Compact memory to make a file
-      c.tableOperations().compact(tableName, null, null, true, true);
-
-      // Make sure that we'll have a WAL
-      m = new Mutation("row2");
-      m.put("cf", "cq", "value");
-      bw.addMutation(m);
-      bw.close();
+      try (BatchWriter bw = c.createBatchWriter(tableName)) {
+        Mutation m = new Mutation("row");
+        m.put("cf", "cq", "value");
+        bw.addMutation(m);
+        bw.flush();
+        // Compact memory to make a file
+        c.tableOperations().compact(tableName, null, null, true, true);
+        // Make sure that we'll have a WAL
+        m = new Mutation("row2");
+        m.put("cf", "cq", "value");
+        bw.addMutation(m);
+      }
 
       // create a fake _tmp file in its directory
       String id = c.tableOperations().tableIdMap().get(tableName);
diff --git a/test/src/main/java/org/apache/accumulo/test/functional/CombinerIT.java b/test/src/main/java/org/apache/accumulo/test/functional/CombinerIT.java
index 0ea4e09..82eef85 100644
--- a/test/src/main/java/org/apache/accumulo/test/functional/CombinerIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/functional/CombinerIT.java
@@ -26,7 +26,6 @@ import java.util.Map.Entry;
 
 import org.apache.accumulo.core.client.AccumuloClient;
 import org.apache.accumulo.core.client.BatchWriter;
-import org.apache.accumulo.core.client.BatchWriterConfig;
 import org.apache.accumulo.core.client.IteratorSetting;
 import org.apache.accumulo.core.client.Scanner;
 import org.apache.accumulo.core.data.Key;
@@ -65,15 +64,14 @@ public class CombinerIT extends AccumuloClusterHarness {
       SummingCombiner.setColumns(setting,
           Collections.singletonList(new IteratorSetting.Column("cf")));
       c.tableOperations().attachIterator(tableName, setting);
-      BatchWriter bw = c.createBatchWriter(tableName, new BatchWriterConfig());
-      for (int i = 0; i < 10; i++) {
-        Mutation m = new Mutation("row1");
-        m.put("cf".getBytes(), "col1".getBytes(), ("" + i).getBytes());
-        bw.addMutation(m);
+      try (BatchWriter bw = c.createBatchWriter(tableName)) {
+        for (int i = 0; i < 10; i++) {
+          Mutation m = new Mutation("row1");
+          m.put("cf".getBytes(), "col1".getBytes(), ("" + i).getBytes());
+          bw.addMutation(m);
+        }
       }
-      bw.close();
       checkSum(tableName, c);
     }
   }
-
 }
diff --git a/test/src/main/java/org/apache/accumulo/test/functional/ConcurrentDeleteTableIT.java b/test/src/main/java/org/apache/accumulo/test/functional/ConcurrentDeleteTableIT.java
index 782a2b5..03a3ec3 100644
--- a/test/src/main/java/org/apache/accumulo/test/functional/ConcurrentDeleteTableIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/functional/ConcurrentDeleteTableIT.java
@@ -37,7 +37,6 @@ import org.apache.accumulo.core.client.AccumuloClient;
 import org.apache.accumulo.core.client.AccumuloException;
 import org.apache.accumulo.core.client.AccumuloSecurityException;
 import org.apache.accumulo.core.client.BatchWriter;
-import org.apache.accumulo.core.client.BatchWriterConfig;
 import org.apache.accumulo.core.client.MutationsRejectedException;
 import org.apache.accumulo.core.client.TableNotFoundException;
 import org.apache.accumulo.core.client.TableOfflineException;
@@ -263,7 +262,7 @@ public class ConcurrentDeleteTableIT extends AccumuloClusterHarness {
 
   private void writeData(AccumuloClient c, String table)
       throws TableNotFoundException, MutationsRejectedException {
-    try (BatchWriter bw = c.createBatchWriter(table, new BatchWriterConfig())) {
+    try (BatchWriter bw = c.createBatchWriter(table)) {
       Random rand = new SecureRandom();
       for (int i = 0; i < 1000; i++) {
         Mutation m = new Mutation(String.format("%09x", rand.nextInt(100000 * 1000)));
diff --git a/test/src/main/java/org/apache/accumulo/test/functional/ConfigurableCompactionIT.java b/test/src/main/java/org/apache/accumulo/test/functional/ConfigurableCompactionIT.java
index 4fbbd21..cec0ff5 100644
--- a/test/src/main/java/org/apache/accumulo/test/functional/ConfigurableCompactionIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/functional/ConfigurableCompactionIT.java
@@ -30,7 +30,6 @@ import java.util.TreeSet;
 
 import org.apache.accumulo.core.client.AccumuloClient;
 import org.apache.accumulo.core.client.BatchWriter;
-import org.apache.accumulo.core.client.BatchWriterConfig;
 import org.apache.accumulo.core.client.Scanner;
 import org.apache.accumulo.core.conf.Property;
 import org.apache.accumulo.core.data.Mutation;
@@ -139,26 +138,26 @@ public class ConfigurableCompactionIT extends ConfigurableMacBase {
   }
 
   private void writeFlush(AccumuloClient client, String tablename, String row) throws Exception {
-    BatchWriter bw = client.createBatchWriter(tablename, new BatchWriterConfig());
-    Mutation m = new Mutation(row);
-    m.put("", "", "");
-    bw.addMutation(m);
-    bw.close();
+    try (BatchWriter bw = client.createBatchWriter(tablename)) {
+      Mutation m = new Mutation(row);
+      m.put("", "", "");
+      bw.addMutation(m);
+    }
     client.tableOperations().flush(tablename, null, null, true);
   }
 
   static final Random r = new SecureRandom();
 
   private void makeFile(AccumuloClient client, String tablename) throws Exception {
-    BatchWriter bw = client.createBatchWriter(tablename, new BatchWriterConfig());
-    byte[] empty = {};
-    byte[] row = new byte[10];
-    r.nextBytes(row);
-    Mutation m = new Mutation(row, 0, 10);
-    m.put(empty, empty, empty);
-    bw.addMutation(m);
-    bw.flush();
-    bw.close();
+    try (BatchWriter bw = client.createBatchWriter(tablename)) {
+      byte[] empty = {};
+      byte[] row = new byte[10];
+      r.nextBytes(row);
+      Mutation m = new Mutation(row, 0, 10);
+      m.put(empty, empty, empty);
+      bw.addMutation(m);
+      bw.flush();
+    }
     client.tableOperations().flush(tablename, null, null, true);
   }
 
diff --git a/test/src/main/java/org/apache/accumulo/test/functional/CreateAndUseIT.java b/test/src/main/java/org/apache/accumulo/test/functional/CreateAndUseIT.java
index 6a32a2a..e640f04 100644
--- a/test/src/main/java/org/apache/accumulo/test/functional/CreateAndUseIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/functional/CreateAndUseIT.java
@@ -28,7 +28,6 @@ import java.util.TreeSet;
 import org.apache.accumulo.core.client.AccumuloClient;
 import org.apache.accumulo.core.client.BatchScanner;
 import org.apache.accumulo.core.client.BatchWriter;
-import org.apache.accumulo.core.client.BatchWriterConfig;
 import org.apache.accumulo.core.client.Scanner;
 import org.apache.accumulo.core.data.Key;
 import org.apache.accumulo.core.data.Mutation;
@@ -71,16 +70,14 @@ public class CreateAndUseIT extends AccumuloClusterHarness {
       String tableName = getUniqueNames(1)[0];
       client.tableOperations().create(tableName);
       client.tableOperations().addSplits(tableName, splits);
-      BatchWriter bw = client.createBatchWriter(tableName, new BatchWriterConfig());
-
-      for (int i = 1; i < 257; i++) {
-        Mutation m = new Mutation(new Text(String.format("%08x", (i << 8) - 16)));
-        m.put(cf, cq, new Value(Integer.toString(i).getBytes(UTF_8)));
-
-        bw.addMutation(m);
+      try (BatchWriter bw = client.createBatchWriter(tableName)) {
+        for (int i = 1; i < 257; i++) {
+          Mutation m = new Mutation(new Text(String.format("%08x", (i << 8) - 16)));
+          m.put(cf, cq, new Value(Integer.toString(i).getBytes(UTF_8)));
+          bw.addMutation(m);
+        }
       }
 
-      bw.close();
       try (Scanner scanner1 = client.createScanner(tableName, Authorizations.EMPTY)) {
 
         int ei = 1;
diff --git a/test/src/main/java/org/apache/accumulo/test/functional/DeleteRowsIT.java b/test/src/main/java/org/apache/accumulo/test/functional/DeleteRowsIT.java
index d27bb3c..8e6689b 100644
--- a/test/src/main/java/org/apache/accumulo/test/functional/DeleteRowsIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/functional/DeleteRowsIT.java
@@ -120,16 +120,16 @@ public class DeleteRowsIT extends AccumuloClusterHarness {
       int entries) throws Exception {
     // Put a bunch of rows on each tablet
     c.tableOperations().create(table);
-    BatchWriter bw = c.createBatchWriter(table, null);
-    for (String row : ROWS) {
-      for (int j = 0; j < ROWS_PER_TABLET; j++) {
-        Mutation m = new Mutation(row + j);
-        m.put("cf", "cq", "value");
-        bw.addMutation(m);
+    try (BatchWriter bw = c.createBatchWriter(table)) {
+      for (String row : ROWS) {
+        for (int j = 0; j < ROWS_PER_TABLET; j++) {
+          Mutation m = new Mutation(row + j);
+          m.put("cf", "cq", "value");
+          bw.addMutation(m);
+        }
       }
+      bw.flush();
     }
-    bw.flush();
-    bw.close();
     // Split the table
     c.tableOperations().addSplits(table, SPLITS);
 
diff --git a/test/src/main/java/org/apache/accumulo/test/functional/DeleteRowsSplitIT.java b/test/src/main/java/org/apache/accumulo/test/functional/DeleteRowsSplitIT.java
index 5583793..e602347 100644
--- a/test/src/main/java/org/apache/accumulo/test/functional/DeleteRowsSplitIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/functional/DeleteRowsSplitIT.java
@@ -30,7 +30,6 @@ import java.util.concurrent.TimeUnit;
 
 import org.apache.accumulo.core.client.AccumuloClient;
 import org.apache.accumulo.core.client.BatchWriter;
-import org.apache.accumulo.core.client.BatchWriterConfig;
 import org.apache.accumulo.core.client.Scanner;
 import org.apache.accumulo.core.data.Key;
 import org.apache.accumulo.core.data.Mutation;
@@ -136,12 +135,12 @@ public class DeleteRowsSplitIT extends AccumuloClusterHarness {
   }
 
   private void fillTable(AccumuloClient client, String table) throws Exception {
-    BatchWriter bw = client.createBatchWriter(table, new BatchWriterConfig());
-    for (String row : ROWS) {
-      Mutation m = new Mutation(row);
-      m.put("cf", "cq", "value");
-      bw.addMutation(m);
+    try (BatchWriter bw = client.createBatchWriter(table)) {
+      for (String row : ROWS) {
+        Mutation m = new Mutation(row);
+        m.put("cf", "cq", "value");
+        bw.addMutation(m);
+      }
     }
-    bw.close();
   }
 }
diff --git a/test/src/main/java/org/apache/accumulo/test/functional/DeletedTablesDontFlushIT.java b/test/src/main/java/org/apache/accumulo/test/functional/DeletedTablesDontFlushIT.java
index 899f3af..f7fc0ec 100644
--- a/test/src/main/java/org/apache/accumulo/test/functional/DeletedTablesDontFlushIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/functional/DeletedTablesDontFlushIT.java
@@ -20,7 +20,6 @@ import java.util.EnumSet;
 
 import org.apache.accumulo.core.client.AccumuloClient;
 import org.apache.accumulo.core.client.BatchWriter;
-import org.apache.accumulo.core.client.BatchWriterConfig;
 import org.apache.accumulo.core.client.IteratorSetting;
 import org.apache.accumulo.core.data.Mutation;
 import org.apache.accumulo.core.data.Value;
@@ -64,12 +63,11 @@ public class DeletedTablesDontFlushIT extends SharedMiniClusterBase {
       for (int i = 0; i < 100; i++) {
         m.put("cf", "" + i, new Value(new byte[] {}));
       }
-      BatchWriter bw = c.createBatchWriter(tableName, new BatchWriterConfig());
-      bw.addMutation(m);
-      bw.close();
+      try (BatchWriter bw = c.createBatchWriter(tableName)) {
+        bw.addMutation(m);
+      }
       // should go fast
       c.tableOperations().delete(tableName);
     }
   }
-
 }
diff --git a/test/src/main/java/org/apache/accumulo/test/functional/DurabilityIT.java b/test/src/main/java/org/apache/accumulo/test/functional/DurabilityIT.java
index 475e94b..52a5c1a 100644
--- a/test/src/main/java/org/apache/accumulo/test/functional/DurabilityIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/functional/DurabilityIT.java
@@ -222,16 +222,16 @@ public class DurabilityIT extends ConfigurableMacBase {
     long[] attempts = new long[iterations];
     for (int attempt = 0; attempt < iterations; attempt++) {
       long now = System.currentTimeMillis();
-      BatchWriter bw = c.createBatchWriter(table, null);
-      for (int i = 1; i < count + 1; i++) {
-        Mutation m = new Mutation("" + i);
-        m.put("", "", "");
-        bw.addMutation(m);
-        if (i % (Math.max(1, count / 100)) == 0) {
-          bw.flush();
+      try (BatchWriter bw = c.createBatchWriter(table)) {
+        for (int i = 1; i < count + 1; i++) {
+          Mutation m = new Mutation("" + i);
+          m.put("", "", "");
+          bw.addMutation(m);
+          if (i % (Math.max(1, count / 100)) == 0) {
+            bw.flush();
+          }
         }
       }
-      bw.close();
       attempts[attempt] = System.currentTimeMillis() - now;
     }
     Arrays.sort(attempts);
diff --git a/test/src/main/java/org/apache/accumulo/test/functional/FateConcurrencyIT.java b/test/src/main/java/org/apache/accumulo/test/functional/FateConcurrencyIT.java
index 8f50c4d..b670683 100644
--- a/test/src/main/java/org/apache/accumulo/test/functional/FateConcurrencyIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/functional/FateConcurrencyIT.java
@@ -34,7 +34,6 @@ import org.apache.accumulo.core.client.AccumuloClient;
 import org.apache.accumulo.core.client.AccumuloException;
 import org.apache.accumulo.core.client.AccumuloSecurityException;
 import org.apache.accumulo.core.client.BatchWriter;
-import org.apache.accumulo.core.client.BatchWriterConfig;
 import org.apache.accumulo.core.client.IteratorSetting;
 import org.apache.accumulo.core.client.Scanner;
 import org.apache.accumulo.core.client.TableExistsException;
@@ -403,15 +402,15 @@ public class FateConcurrencyIT extends AccumuloClusterHarness {
 
       // create table.
       accumuloClient.tableOperations().create(tableName);
-      BatchWriter bw = accumuloClient.createBatchWriter(tableName, new BatchWriterConfig());
-
-      // populate
-      for (int i = 0; i < NUM_ROWS; i++) {
-        Mutation m = new Mutation(new Text(String.format("%05d", i)));
-        m.put(new Text("col" + ((i % 3) + 1)), new Text("qual"), new Value("junk".getBytes(UTF_8)));
-        bw.addMutation(m);
+      try (BatchWriter bw = accumuloClient.createBatchWriter(tableName)) {
+        // populate
+        for (int i = 0; i < NUM_ROWS; i++) {
+          Mutation m = new Mutation(new Text(String.format("%05d", i)));
+          m.put(new Text("col" + ((i % 3) + 1)), new Text("qual"),
+              new Value("junk".getBytes(UTF_8)));
+          bw.addMutation(m);
+        }
       }
-      bw.close();
 
       long startTimestamp = System.nanoTime();
 
diff --git a/test/src/main/java/org/apache/accumulo/test/functional/GarbageCollectorIT.java b/test/src/main/java/org/apache/accumulo/test/functional/GarbageCollectorIT.java
index ab8420f..42354a1 100644
--- a/test/src/main/java/org/apache/accumulo/test/functional/GarbageCollectorIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/functional/GarbageCollectorIT.java
@@ -37,7 +37,6 @@ import org.apache.accumulo.core.cli.BatchWriterOpts;
 import org.apache.accumulo.core.cli.ScannerOpts;
 import org.apache.accumulo.core.client.AccumuloClient;
 import org.apache.accumulo.core.client.BatchWriter;
-import org.apache.accumulo.core.client.BatchWriterConfig;
 import org.apache.accumulo.core.client.Scanner;
 import org.apache.accumulo.core.conf.Property;
 import org.apache.accumulo.core.data.Key;
@@ -202,23 +201,22 @@ public class GarbageCollectorIT extends ConfigurableMacBase {
       String table = getUniqueNames(1)[0];
       c.tableOperations().create(table);
 
-      BatchWriter bw2 = c.createBatchWriter(table, new BatchWriterConfig());
-      Mutation m1 = new Mutation("r1");
-      m1.put("cf1", "cq1", "v1");
-      bw2.addMutation(m1);
-      bw2.close();
+      try (BatchWriter bw = c.createBatchWriter(table)) {
+        Mutation m1 = new Mutation("r1");
+        m1.put("cf1", "cq1", "v1");
+        bw.addMutation(m1);
+      }
 
       c.tableOperations().flush(table, null, null, true);
 
       // ensure an invalid delete entry does not cause GC to go berserk ACCUMULO-2520
       c.securityOperations().grantTablePermission(c.whoami(), MetadataTable.NAME,
           TablePermission.WRITE);
-      BatchWriter bw3 = c.createBatchWriter(MetadataTable.NAME, new BatchWriterConfig());
-
-      bw3.addMutation(createDelMutation("", "", "", ""));
-      bw3.addMutation(createDelMutation("", "testDel", "test", "valueTest"));
-      bw3.addMutation(createDelMutation("/", "", "", ""));
-      bw3.close();
+      try (BatchWriter bw = c.createBatchWriter(MetadataTable.NAME)) {
+        bw.addMutation(createDelMutation("", "", "", ""));
+        bw.addMutation(createDelMutation("", "testDel", "test", "valueTest"));
+        bw.addMutation(createDelMutation("/", "", "", ""));
+      }
 
       ProcessInfo gc = cluster.exec(SimpleGarbageCollector.class);
       try {
@@ -304,17 +302,18 @@ public class GarbageCollectorIT extends ConfigurableMacBase {
   public static void addEntries(AccumuloClient client, BatchWriterOpts bwOpts) throws Exception {
     client.securityOperations().grantTablePermission(client.whoami(), MetadataTable.NAME,
         TablePermission.WRITE);
-    BatchWriter bw = client.createBatchWriter(MetadataTable.NAME, bwOpts.getBatchWriterConfig());
-
-    for (int i = 0; i < 100000; ++i) {
-      final Text emptyText = new Text("");
-      Text row = new Text(String.format("%s/%020d/%s", MetadataSchema.DeletesSection.getRowPrefix(),
-          i, "aaaaaaaaaabbbbbbbbbbccccccccccddddddddddeeeeeeeeee"
-              + "ffffffffffgggggggggghhhhhhhhhhiiiiiiiiiijjjjjjjjjj"));
-      Mutation delFlag = new Mutation(row);
-      delFlag.put(emptyText, emptyText, new Value(new byte[] {}));
-      bw.addMutation(delFlag);
+    try (BatchWriter bw = client.createBatchWriter(MetadataTable.NAME,
+        bwOpts.getBatchWriterConfig())) {
+      for (int i = 0; i < 100000; ++i) {
+        final Text emptyText = new Text("");
+        Text row = new Text(
+            String.format("%s/%020d/%s", MetadataSchema.DeletesSection.getRowPrefix(), i,
+                "aaaaaaaaaabbbbbbbbbbccccccccccddddddddddeeeeeeeeee"
+                    + "ffffffffffgggggggggghhhhhhhhhhiiiiiiiiiijjjjjjjjjj"));
+        Mutation delFlag = new Mutation(row);
+        delFlag.put(emptyText, emptyText, new Value(new byte[] {}));
+        bw.addMutation(delFlag);
+      }
     }
-    bw.close();
   }
 }
diff --git a/test/src/main/java/org/apache/accumulo/test/functional/KerberosIT.java b/test/src/main/java/org/apache/accumulo/test/functional/KerberosIT.java
index a62daa9..9315a17 100644
--- a/test/src/main/java/org/apache/accumulo/test/functional/KerberosIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/functional/KerberosIT.java
@@ -39,7 +39,6 @@ import org.apache.accumulo.core.client.AccumuloException;
 import org.apache.accumulo.core.client.AccumuloSecurityException;
 import org.apache.accumulo.core.client.BatchScanner;
 import org.apache.accumulo.core.client.BatchWriter;
-import org.apache.accumulo.core.client.BatchWriterConfig;
 import org.apache.accumulo.core.client.Scanner;
 import org.apache.accumulo.core.client.TableExistsException;
 import org.apache.accumulo.core.client.TableNotFoundException;
@@ -289,11 +288,11 @@ public class KerberosIT extends AccumuloITBase {
       client.tableOperations().create(table);
 
       // Make sure we can actually use the table we made
-      BatchWriter bw = client.createBatchWriter(table, new BatchWriterConfig());
-      Mutation m = new Mutation("a");
-      m.put("b", "c", "d");
-      bw.addMutation(m);
-      bw.close();
+      try (BatchWriter bw = client.createBatchWriter(table)) {
+        Mutation m = new Mutation("a");
+        m.put("b", "c", "d");
+        bw.addMutation(m);
+      }
 
       client.tableOperations().compact(table, new CompactionConfig().setWait(true).setFlush(true));
       return null;
@@ -362,11 +361,11 @@ public class KerberosIT extends AccumuloITBase {
 
       // Write data
       final long ts = 1000L;
-      BatchWriter bw = client.createBatchWriter(table, new BatchWriterConfig());
-      Mutation m = new Mutation("a");
-      m.put("b", "c", new ColumnVisibility(viz.getBytes()), ts, "d");
-      bw.addMutation(m);
-      bw.close();
+      try (BatchWriter bw = client.createBatchWriter(table)) {
+        Mutation m = new Mutation("a");
+        m.put("b", "c", new ColumnVisibility(viz.getBytes()), ts, "d");
+        bw.addMutation(m);
+      }
 
       // Compact
       client.tableOperations().compact(table, new CompactionConfig().setWait(true).setFlush(true));
@@ -407,16 +406,16 @@ public class KerberosIT extends AccumuloITBase {
           assertEquals(rootUser.getPrincipal(), client.whoami());
 
           client.tableOperations().create(tableName);
-          BatchWriter bw = client.createBatchWriter(tableName, new BatchWriterConfig());
-          for (int r = 0; r < numRows; r++) {
-            Mutation m = new Mutation(Integer.toString(r));
-            for (int c = 0; c < numColumns; c++) {
-              String col = Integer.toString(c);
-              m.put(col, col, col);
+          try (BatchWriter bw = client.createBatchWriter(tableName)) {
+            for (int r = 0; r < numRows; r++) {
+              Mutation m = new Mutation(Integer.toString(r));
+              for (int c = 0; c < numColumns; c++) {
+                String col = Integer.toString(c);
+                m.put(col, col, col);
+              }
+              bw.addMutation(m);
             }
-            bw.addMutation(m);
           }
-          bw.close();
 
           return client.securityOperations().getDelegationToken(new DelegationTokenConfig());
         });
@@ -655,11 +654,11 @@ public class KerberosIT extends AccumuloITBase {
       AccumuloSecurityException, AccumuloException, TableExistsException {
     final String table = testName.getMethodName() + "_table";
     client.tableOperations().create(table);
-    BatchWriter bw = client.createBatchWriter(table, new BatchWriterConfig());
-    Mutation m = new Mutation("a");
-    m.put("b", "c", "d");
-    bw.addMutation(m);
-    bw.close();
+    try (BatchWriter bw = client.createBatchWriter(table)) {
+      Mutation m = new Mutation("a");
+      m.put("b", "c", "d");
+      bw.addMutation(m);
+    }
     client.tableOperations().compact(table, new CompactionConfig().setFlush(true).setWait(true));
   }
 }