From fbf00f9c287acee55b02993f112b514247cddd86 Mon Sep 17 00:00:00 2001 From: Duo Zhang Date: Thu, 31 Dec 2020 16:57:27 +0800 Subject: [PATCH] HBASE-25451 Upgrade commons-io to 2.8.0 (#2825) Signed-off-by: Guanghao Zhang Signed-off-by: stack --- .../hbase/client/AsyncConnectionImpl.java | 7 +++--- .../client/example/AsyncClientExample.java | 2 +- .../hbase/io/FSDataInputStreamWrapper.java | 8 +++---- .../apache/hadoop/hbase/io/hfile/HFile.java | 3 ++- .../hadoop/hbase/io/hfile/HFileInfo.java | 17 +++++++++---- .../apache/hadoop/hbase/master/HMaster.java | 4 ++-- .../apache/hadoop/hbase/util/HBaseFsck.java | 13 +++++----- .../apache/hadoop/hbase/util/RegionMover.java | 4 ++-- ...tractTestAsyncTableRegionReplicasRead.java | 5 ++-- .../hbase/client/TestAsyncAdminBase.java | 5 ++-- .../hbase/client/TestAsyncAdminBuilder.java | 5 ++-- .../client/TestAsyncClusterAdminApi2.java | 5 ++-- .../client/TestAsyncMetaRegionLocator.java | 5 ++-- .../client/TestAsyncNonMetaRegionLocator.java | 5 ++-- ...ncNonMetaRegionLocatorConcurrenyLimit.java | 5 ++-- .../hbase/client/TestAsyncRegionLocator.java | 5 ++-- ...stAsyncSingleRequestRpcRetryingCaller.java | 5 ++-- .../hadoop/hbase/client/TestAsyncTable.java | 5 ++-- ...AsyncTableLocateRegionForDeletedTable.java | 5 ++-- .../client/TestAsyncTableNoncedRetry.java | 5 ++-- .../client/TestAsyncTableScanMetrics.java | 5 ++-- ...talogReplicaLoadBalanceSimpleSelector.java | 6 +++-- .../client/TestMetaRegionLocationCache.java | 5 ++-- .../client/TestZKConnectionRegistry.java | 5 ++-- ...TestMasterOperationsForRegionReplicas.java | 4 ++-- .../TestEndToEndSplitTransaction.java | 24 ++++++------------- .../TestSplitTransactionOnCluster.java | 4 ++-- .../replication/TestReplicationBase.java | 12 ++++++---- .../TestReplicationSyncUpToolBase.java | 13 ++++++---- .../TestSerialReplicationEndpoint.java | 5 ++-- pom.xml | 2 +- 31 files changed, 113 insertions(+), 90 deletions(-) diff --git a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/AsyncConnectionImpl.java b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/AsyncConnectionImpl.java index 83beaf1f40b..1dbb7e6d211 100644 --- a/hbase-client/src/main/java/org/apache/hadoop/hbase/client/AsyncConnectionImpl.java +++ b/hbase-client/src/main/java/org/apache/hadoop/hbase/client/AsyncConnectionImpl.java @@ -212,9 +212,10 @@ class AsyncConnectionImpl implements AsyncConnection { if(LOG.isDebugEnabled()){ logCallStack(Thread.currentThread().getStackTrace()); } - IOUtils.closeQuietly(clusterStatusListener); - IOUtils.closeQuietly(rpcClient); - IOUtils.closeQuietly(registry); + IOUtils.closeQuietly(clusterStatusListener, + e -> LOG.warn("failed to close clusterStatusListener", e)); + IOUtils.closeQuietly(rpcClient, e -> LOG.warn("failed to close rpcClient", e)); + IOUtils.closeQuietly(registry, e -> LOG.warn("failed to close registry", e)); if (choreService != null) { choreService.shutdown(); } diff --git a/hbase-examples/src/main/java/org/apache/hadoop/hbase/client/example/AsyncClientExample.java b/hbase-examples/src/main/java/org/apache/hadoop/hbase/client/example/AsyncClientExample.java index b773ee89ff5..fdbdbc6244f 100644 --- a/hbase-examples/src/main/java/org/apache/hadoop/hbase/client/example/AsyncClientExample.java +++ b/hbase-examples/src/main/java/org/apache/hadoop/hbase/client/example/AsyncClientExample.java @@ -111,7 +111,7 @@ public class AsyncClientExample extends Configured implements Tool { CompletableFuture closeFuture = new CompletableFuture<>(); addListener(f, (conn, error) -> { if (error == null) { - IOUtils.closeQuietly(conn); + IOUtils.closeQuietly(conn, e -> LOG.warn("failed to close conn", e)); } closeFuture.complete(null); }); diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/io/FSDataInputStreamWrapper.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/io/FSDataInputStreamWrapper.java index d83a9d9da90..5bbc525b845 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/io/FSDataInputStreamWrapper.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/io/FSDataInputStreamWrapper.java @@ -21,8 +21,6 @@ import java.io.Closeable; import java.io.IOException; import java.io.InputStream; import java.util.concurrent.atomic.AtomicInteger; - -import org.apache.commons.io.IOUtils; import org.apache.hadoop.fs.CanUnbuffer; import org.apache.hadoop.fs.FSDataInputStream; import org.apache.hadoop.fs.FileSystem; @@ -33,6 +31,8 @@ import org.apache.yetus.audience.InterfaceAudience; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.apache.hbase.thirdparty.com.google.common.io.Closeables; + /** * Wrapper for input stream(s) that takes care of the interaction of FS and HBase checksums, * as well as closing streams. Initialization is not thread-safe, but normal operation is; @@ -289,11 +289,11 @@ public class FSDataInputStreamWrapper implements Closeable { } updateInputStreamStatistics(this.streamNoFsChecksum); // we do not care about the close exception as it is for reading, no data loss issue. - IOUtils.closeQuietly(streamNoFsChecksum); + Closeables.closeQuietly(streamNoFsChecksum); updateInputStreamStatistics(stream); - IOUtils.closeQuietly(stream); + Closeables.closeQuietly(stream); } public HFileSystem getHfs() { diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/HFile.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/HFile.java index 52b6359d92c..ed0e84deace 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/HFile.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/HFile.java @@ -505,7 +505,8 @@ public final class HFile { throw new IllegalArgumentException("Invalid HFile version " + trailer.getMajorVersion()); } } catch (Throwable t) { - IOUtils.closeQuietly(context.getInputStreamWrapper()); + IOUtils.closeQuietly(context.getInputStreamWrapper(), + e -> LOG.warn("failed to close input stream wrapper", e)); throw new CorruptHFileException("Problem reading HFile Trailer from file " + context.getFilePath(), t); } finally { diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/HFileInfo.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/HFileInfo.java index 5d65ff3b3a3..072e5b10628 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/HFileInfo.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/io/hfile/HFileInfo.java @@ -44,7 +44,11 @@ import org.apache.hadoop.hbase.protobuf.ProtobufMagic; import org.apache.hadoop.hbase.security.EncryptionUtil; import org.apache.hadoop.hbase.util.Bytes; import org.apache.yetus.audience.InterfaceAudience; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + import org.apache.hbase.thirdparty.com.google.protobuf.UnsafeByteOperations; + import org.apache.hadoop.hbase.shaded.protobuf.ProtobufUtil; import org.apache.hadoop.hbase.shaded.protobuf.generated.HBaseProtos; import org.apache.hadoop.hbase.shaded.protobuf.generated.HBaseProtos.BytesBytesPair; @@ -62,6 +66,9 @@ import org.apache.hadoop.hbase.shaded.protobuf.generated.HFileProtos; */ @InterfaceAudience.Private public class HFileInfo implements SortedMap { + + private static final Logger LOG = LoggerFactory.getLogger(HFileInfo.class); + static final String RESERVED_PREFIX = "hfile."; static final byte[] RESERVED_PREFIX_BYTES = Bytes.toBytes(RESERVED_PREFIX); static final byte [] LASTKEY = Bytes.toBytes(RESERVED_PREFIX + "LASTKEY"); @@ -344,7 +351,8 @@ public class HFileInfo implements SortedMap { this.hfileContext = createHFileContext(path, trailer, conf); context.getInputStreamWrapper().unbuffer(); } catch (Throwable t) { - IOUtils.closeQuietly(context.getInputStreamWrapper()); + IOUtils.closeQuietly(context.getInputStreamWrapper(), + e -> LOG.warn("failed to close input stream wrapper", e)); throw new CorruptHFileException("Problem reading HFile Trailer from file " + context.getFilePath(), t); } @@ -382,9 +390,10 @@ public class HFileInfo implements SortedMap { // close the block reader context.getInputStreamWrapper().unbuffer(); } catch (Throwable t) { - IOUtils.closeQuietly(context.getInputStreamWrapper()); - throw new CorruptHFileException("Problem reading data index and meta index from file " - + context.getFilePath(), t); + IOUtils.closeQuietly(context.getInputStreamWrapper(), + e -> LOG.warn("failed to close input stream wrapper", e)); + throw new CorruptHFileException( + "Problem reading data index and meta index from file " + context.getFilePath(), t); } } diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMaster.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMaster.java index a1e68bf3c9e..cbe001e9158 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMaster.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/HMaster.java @@ -51,7 +51,6 @@ import java.util.concurrent.atomic.AtomicInteger; import java.util.regex.Pattern; import java.util.stream.Collectors; import javax.servlet.http.HttpServlet; -import org.apache.commons.io.IOUtils; import org.apache.commons.lang3.StringUtils; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.fs.FSDataOutputStream; @@ -221,6 +220,7 @@ import org.slf4j.LoggerFactory; import org.apache.hbase.thirdparty.com.google.common.collect.Lists; import org.apache.hbase.thirdparty.com.google.common.collect.Maps; import org.apache.hbase.thirdparty.com.google.common.collect.Sets; +import org.apache.hbase.thirdparty.com.google.common.io.Closeables; import org.apache.hbase.thirdparty.com.google.protobuf.Descriptors; import org.apache.hbase.thirdparty.com.google.protobuf.Service; import org.apache.hbase.thirdparty.org.eclipse.jetty.server.Server; @@ -832,7 +832,7 @@ public class HMaster extends HRegionServer implements MasterServices { HBaseFsck.createLockRetryCounterFactory(this.conf).create()); } finally { if (result != null) { - IOUtils.closeQuietly(result.getSecond()); + Closeables.close(result.getSecond(), true); } } } diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/util/HBaseFsck.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/util/HBaseFsck.java index 4ea4c9e14df..28f0d5eb887 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/util/HBaseFsck.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/util/HBaseFsck.java @@ -138,6 +138,7 @@ import org.apache.hbase.thirdparty.com.google.common.base.Joiner; import org.apache.hbase.thirdparty.com.google.common.base.Preconditions; import org.apache.hbase.thirdparty.com.google.common.collect.Lists; import org.apache.hbase.thirdparty.com.google.common.collect.Sets; +import org.apache.hbase.thirdparty.com.google.common.io.Closeables; import org.apache.hbase.thirdparty.com.google.common.util.concurrent.ThreadFactoryBuilder; import org.apache.yetus.audience.InterfaceAudience; import org.apache.yetus.audience.InterfaceStability; @@ -511,7 +512,7 @@ public class HBaseFsck extends Configured implements Closeable { RetryCounter retryCounter = lockFileRetryCounterFactory.create(); do { try { - IOUtils.closeQuietly(hbckOutFd); + Closeables.close(hbckOutFd, true); CommonFSUtils.delete(CommonFSUtils.getCurrentFileSystem(getConf()), HBCK_LOCK_PATH, true); LOG.info("Finishing hbck"); return; @@ -564,7 +565,7 @@ public class HBaseFsck extends Configured implements Closeable { Runtime.getRuntime().addShutdownHook(new Thread() { @Override public void run() { - IOUtils.closeQuietly(HBaseFsck.this); + IOUtils.closeQuietly(HBaseFsck.this, e -> LOG.warn("", e)); cleanupHbckZnode(); unlockHbck(); } @@ -863,9 +864,9 @@ public class HBaseFsck extends Configured implements Closeable { zkw.close(); zkw = null; } - IOUtils.closeQuietly(admin); - IOUtils.closeQuietly(meta); - IOUtils.closeQuietly(connection); + IOUtils.closeQuietly(admin, e -> LOG.warn("", e)); + IOUtils.closeQuietly(meta, e -> LOG.warn("", e)); + IOUtils.closeQuietly(connection, e -> LOG.warn("", e)); } } @@ -3845,7 +3846,7 @@ public class HBaseFsck extends Configured implements Closeable { setRetCode(code); } } finally { - IOUtils.closeQuietly(this); + IOUtils.closeQuietly(this, e -> LOG.warn("", e)); } return this; } diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/util/RegionMover.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/util/RegionMover.java index 2f7d351ff99..08042efda68 100644 --- a/hbase-server/src/main/java/org/apache/hadoop/hbase/util/RegionMover.java +++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/util/RegionMover.java @@ -121,8 +121,8 @@ public class RegionMover extends AbstractHBaseTool implements Closeable { @Override public void close() { - IOUtils.closeQuietly(this.admin); - IOUtils.closeQuietly(this.conn); + IOUtils.closeQuietly(this.admin, e -> LOG.warn("failed to close admin", e)); + IOUtils.closeQuietly(this.conn, e -> LOG.warn("failed to close conn", e)); } /** diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/AbstractTestAsyncTableRegionReplicasRead.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/AbstractTestAsyncTableRegionReplicasRead.java index 65c537aa31b..0a72d836bbc 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/AbstractTestAsyncTableRegionReplicasRead.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/AbstractTestAsyncTableRegionReplicasRead.java @@ -28,7 +28,6 @@ import java.util.concurrent.ConcurrentMap; import java.util.concurrent.ForkJoinPool; import java.util.concurrent.atomic.AtomicInteger; import java.util.function.Supplier; -import org.apache.commons.io.IOUtils; import org.apache.hadoop.hbase.Cell; import org.apache.hadoop.hbase.HBaseTestingUtility; import org.apache.hadoop.hbase.TableName; @@ -46,6 +45,8 @@ import org.junit.rules.TestName; import org.junit.runners.Parameterized.Parameter; import org.junit.runners.Parameterized.Parameters; +import org.apache.hbase.thirdparty.com.google.common.io.Closeables; + public abstract class AbstractTestAsyncTableRegionReplicasRead { protected static final HBaseTestingUtility TEST_UTIL = new HBaseTestingUtility(); @@ -152,7 +153,7 @@ public abstract class AbstractTestAsyncTableRegionReplicasRead { @AfterClass public static void tearDownAfterClass() throws Exception { - IOUtils.closeQuietly(ASYNC_CONN); + Closeables.close(ASYNC_CONN, true); TEST_UTIL.shutdownMiniCluster(); } diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAsyncAdminBase.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAsyncAdminBase.java index 70cffd8cfe1..e895f164cb9 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAsyncAdminBase.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAsyncAdminBase.java @@ -26,7 +26,6 @@ import java.util.concurrent.CompletableFuture; import java.util.concurrent.ForkJoinPool; import java.util.function.Supplier; import java.util.regex.Pattern; -import org.apache.commons.io.IOUtils; import org.apache.hadoop.hbase.HBaseTestingUtility; import org.apache.hadoop.hbase.HConstants; import org.apache.hadoop.hbase.StartMiniClusterOption; @@ -43,6 +42,8 @@ import org.junit.runners.Parameterized.Parameters; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.apache.hbase.thirdparty.com.google.common.io.Closeables; + /** * Class to test AsyncAdmin. */ @@ -92,7 +93,7 @@ public abstract class TestAsyncAdminBase extends AbstractTestUpdateConfiguration @AfterClass public static void tearDownAfterClass() throws Exception { - IOUtils.closeQuietly(ASYNC_CONN); + Closeables.close(ASYNC_CONN, true); TEST_UTIL.shutdownMiniCluster(); } diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAsyncAdminBuilder.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAsyncAdminBuilder.java index f5df30dbba2..d4d0703c9c2 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAsyncAdminBuilder.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAsyncAdminBuilder.java @@ -29,7 +29,6 @@ import java.util.concurrent.ForkJoinPool; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicLong; import java.util.function.Supplier; -import org.apache.commons.io.IOUtils; import org.apache.hadoop.hbase.HBaseClassTestRule; import org.apache.hadoop.hbase.HBaseTestingUtility; import org.apache.hadoop.hbase.HConstants; @@ -53,6 +52,8 @@ import org.junit.runners.Parameterized.Parameters; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.apache.hbase.thirdparty.com.google.common.io.Closeables; + @RunWith(Parameterized.class) @Category({ LargeTests.class, ClientTests.class }) public class TestAsyncAdminBuilder { @@ -98,7 +99,7 @@ public class TestAsyncAdminBuilder { @After public void tearDown() throws Exception { - IOUtils.closeQuietly(ASYNC_CONN); + Closeables.close(ASYNC_CONN, true); TEST_UTIL.shutdownMiniCluster(); } diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAsyncClusterAdminApi2.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAsyncClusterAdminApi2.java index ab6515321c3..e52a2562a45 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAsyncClusterAdminApi2.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAsyncClusterAdminApi2.java @@ -22,7 +22,6 @@ import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; import java.util.concurrent.TimeUnit; -import org.apache.commons.io.IOUtils; import org.apache.hadoop.hbase.HBaseClassTestRule; import org.apache.hadoop.hbase.HConstants; import org.apache.hadoop.hbase.master.HMaster; @@ -37,6 +36,8 @@ import org.junit.ClassRule; import org.junit.Test; import org.junit.experimental.categories.Category; +import org.apache.hbase.thirdparty.com.google.common.io.Closeables; + /** * Only used to test stopMaster/stopRegionServer/shutdown methods. */ @@ -71,7 +72,7 @@ public class TestAsyncClusterAdminApi2 extends TestAsyncAdminBase { @After @Override public void tearDown() throws Exception { - IOUtils.closeQuietly(ASYNC_CONN); + Closeables.close(ASYNC_CONN, true); TEST_UTIL.shutdownMiniCluster(); } diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAsyncMetaRegionLocator.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAsyncMetaRegionLocator.java index 733787773aa..15067070642 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAsyncMetaRegionLocator.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAsyncMetaRegionLocator.java @@ -19,7 +19,6 @@ package org.apache.hadoop.hbase.client; import static org.apache.hadoop.hbase.client.RegionReplicaTestHelper.testLocator; -import org.apache.commons.io.IOUtils; import org.apache.hadoop.hbase.HBaseClassTestRule; import org.apache.hadoop.hbase.HBaseTestingUtility; import org.apache.hadoop.hbase.HRegionLocation; @@ -34,6 +33,8 @@ import org.junit.ClassRule; import org.junit.Test; import org.junit.experimental.categories.Category; +import org.apache.hbase.thirdparty.com.google.common.io.Closeables; + @Category({ MediumTests.class, ClientTests.class }) public class TestAsyncMetaRegionLocator { @@ -60,7 +61,7 @@ public class TestAsyncMetaRegionLocator { @AfterClass public static void tearDown() throws Exception { - IOUtils.closeQuietly(REGISTRY); + Closeables.close(REGISTRY, true); TEST_UTIL.shutdownMiniCluster(); } diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAsyncNonMetaRegionLocator.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAsyncNonMetaRegionLocator.java index 6404a89671b..99d98c92e7b 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAsyncNonMetaRegionLocator.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAsyncNonMetaRegionLocator.java @@ -35,7 +35,6 @@ import java.util.concurrent.CompletableFuture; import java.util.concurrent.ExecutionException; import java.util.concurrent.ThreadLocalRandom; import java.util.stream.IntStream; -import org.apache.commons.io.IOUtils; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.hbase.HBaseClassTestRule; import org.apache.hadoop.hbase.HBaseTestingUtility; @@ -63,6 +62,8 @@ import org.junit.runners.Parameterized; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.apache.hbase.thirdparty.com.google.common.io.Closeables; + @Category({ MediumTests.class, ClientTests.class }) @RunWith(Parameterized.class) public class TestAsyncNonMetaRegionLocator { @@ -116,7 +117,7 @@ public class TestAsyncNonMetaRegionLocator { @AfterClass public static void tearDown() throws Exception { - IOUtils.closeQuietly(CONN); + Closeables.close(CONN, true); TEST_UTIL.shutdownMiniCluster(); } diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAsyncNonMetaRegionLocatorConcurrenyLimit.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAsyncNonMetaRegionLocatorConcurrenyLimit.java index 88ab3ade293..6aad76c37a4 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAsyncNonMetaRegionLocatorConcurrenyLimit.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAsyncNonMetaRegionLocatorConcurrenyLimit.java @@ -32,7 +32,6 @@ import java.util.concurrent.CompletableFuture; import java.util.concurrent.ExecutionException; import java.util.concurrent.atomic.AtomicInteger; import java.util.stream.IntStream; -import org.apache.commons.io.IOUtils; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.hbase.HBaseClassTestRule; import org.apache.hadoop.hbase.HBaseTestingUtility; @@ -55,6 +54,8 @@ import org.junit.ClassRule; import org.junit.Test; import org.junit.experimental.categories.Category; +import org.apache.hbase.thirdparty.com.google.common.io.Closeables; + @Category({ MediumTests.class, ClientTests.class }) public class TestAsyncNonMetaRegionLocatorConcurrenyLimit { @@ -136,7 +137,7 @@ public class TestAsyncNonMetaRegionLocatorConcurrenyLimit { @AfterClass public static void tearDown() throws Exception { - IOUtils.closeQuietly(CONN); + Closeables.close(CONN, true); TEST_UTIL.shutdownMiniCluster(); } diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAsyncRegionLocator.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAsyncRegionLocator.java index 03eac06a571..bdc688e0d9f 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAsyncRegionLocator.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAsyncRegionLocator.java @@ -32,7 +32,6 @@ import java.util.concurrent.CompletionException; import java.util.concurrent.ExecutionException; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicReference; -import org.apache.commons.io.IOUtils; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.hbase.HBaseClassTestRule; import org.apache.hadoop.hbase.HBaseTestingUtility; @@ -56,6 +55,8 @@ import org.junit.ClassRule; import org.junit.Test; import org.junit.experimental.categories.Category; +import org.apache.hbase.thirdparty.com.google.common.io.Closeables; + @Category({ MediumTests.class, ClientTests.class }) public class TestAsyncRegionLocator { @@ -107,7 +108,7 @@ public class TestAsyncRegionLocator { @AfterClass public static void tearDown() throws Exception { - IOUtils.closeQuietly(CONN); + Closeables.close(CONN, true); TEST_UTIL.shutdownMiniCluster(); } diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAsyncSingleRequestRpcRetryingCaller.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAsyncSingleRequestRpcRetryingCaller.java index bf8ce01752e..58c6a04f153 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAsyncSingleRequestRpcRetryingCaller.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAsyncSingleRequestRpcRetryingCaller.java @@ -29,7 +29,6 @@ import java.util.concurrent.ExecutionException; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicInteger; -import org.apache.commons.io.IOUtils; import org.apache.hadoop.hbase.HBaseClassTestRule; import org.apache.hadoop.hbase.HBaseTestingUtility; import org.apache.hadoop.hbase.HRegionLocation; @@ -44,6 +43,8 @@ import org.junit.ClassRule; import org.junit.Test; import org.junit.experimental.categories.Category; +import org.apache.hbase.thirdparty.com.google.common.io.Closeables; + @Category({ MediumTests.class, ClientTests.class }) public class TestAsyncSingleRequestRpcRetryingCaller { @@ -79,7 +80,7 @@ public class TestAsyncSingleRequestRpcRetryingCaller { @AfterClass public static void tearDownAfterClass() throws Exception { - IOUtils.closeQuietly(CONN); + Closeables.close(CONN, true); TEST_UTIL.shutdownMiniCluster(); } diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAsyncTable.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAsyncTable.java index c863ec12a96..f76c923c77b 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAsyncTable.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAsyncTable.java @@ -41,7 +41,6 @@ import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicLong; import java.util.function.Supplier; import java.util.stream.IntStream; -import org.apache.commons.io.IOUtils; import org.apache.hadoop.hbase.CompareOperator; import org.apache.hadoop.hbase.HBaseClassTestRule; import org.apache.hadoop.hbase.HBaseTestingUtility; @@ -71,6 +70,8 @@ import org.junit.runners.Parameterized; import org.junit.runners.Parameterized.Parameter; import org.junit.runners.Parameterized.Parameters; +import org.apache.hbase.thirdparty.com.google.common.io.Closeables; + @RunWith(Parameterized.class) @Category({ MediumTests.class, ClientTests.class }) public class TestAsyncTable { @@ -128,7 +129,7 @@ public class TestAsyncTable { @AfterClass public static void tearDownAfterClass() throws Exception { - IOUtils.closeQuietly(ASYNC_CONN); + Closeables.close(ASYNC_CONN, true); assertTrue(ASYNC_CONN.isClosed()); TEST_UTIL.shutdownMiniCluster(); } diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAsyncTableLocateRegionForDeletedTable.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAsyncTableLocateRegionForDeletedTable.java index 6ccd9bc46f1..ac647c69370 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAsyncTableLocateRegionForDeletedTable.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAsyncTableLocateRegionForDeletedTable.java @@ -21,7 +21,6 @@ import static org.junit.Assert.assertFalse; import static org.junit.Assert.assertTrue; import java.io.IOException; -import org.apache.commons.io.IOUtils; import org.apache.hadoop.hbase.HBaseClassTestRule; import org.apache.hadoop.hbase.HBaseTestingUtility; import org.apache.hadoop.hbase.TableName; @@ -34,6 +33,8 @@ import org.junit.ClassRule; import org.junit.Test; import org.junit.experimental.categories.Category; +import org.apache.hbase.thirdparty.com.google.common.io.Closeables; + /** * Fix an infinite loop in {@link AsyncNonMetaRegionLocator}, see the comments on HBASE-21943 for * more details. @@ -69,7 +70,7 @@ public class TestAsyncTableLocateRegionForDeletedTable { @AfterClass public static void tearDownAfterClass() throws Exception { - IOUtils.closeQuietly(ASYNC_CONN); + Closeables.close(ASYNC_CONN, true); assertTrue(ASYNC_CONN.isClosed()); TEST_UTIL.shutdownMiniCluster(); } diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAsyncTableNoncedRetry.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAsyncTableNoncedRetry.java index 10b358ff625..82cc1a8b961 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAsyncTableNoncedRetry.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAsyncTableNoncedRetry.java @@ -26,7 +26,6 @@ import java.util.Optional; import java.util.concurrent.ExecutionException; import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicInteger; -import org.apache.commons.io.IOUtils; import org.apache.hadoop.hbase.HBaseClassTestRule; import org.apache.hadoop.hbase.HBaseTestingUtility; import org.apache.hadoop.hbase.TableName; @@ -47,6 +46,8 @@ import org.junit.Test; import org.junit.experimental.categories.Category; import org.junit.rules.TestName; +import org.apache.hbase.thirdparty.com.google.common.io.Closeables; + @Category({ MediumTests.class, ClientTests.class }) public class TestAsyncTableNoncedRetry { @@ -114,7 +115,7 @@ public class TestAsyncTableNoncedRetry { @AfterClass public static void tearDownAfterClass() throws Exception { - IOUtils.closeQuietly(ASYNC_CONN); + Closeables.close(ASYNC_CONN, true); TEST_UTIL.shutdownMiniCluster(); } diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAsyncTableScanMetrics.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAsyncTableScanMetrics.java index 7e9f5d9270e..f5aa1967690 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAsyncTableScanMetrics.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestAsyncTableScanMetrics.java @@ -25,7 +25,6 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.List; import java.util.concurrent.ForkJoinPool; -import org.apache.commons.io.IOUtils; import org.apache.hadoop.hbase.HBaseClassTestRule; import org.apache.hadoop.hbase.HBaseTestingUtility; import org.apache.hadoop.hbase.PrivateCellUtil; @@ -45,6 +44,8 @@ import org.junit.runners.Parameterized; import org.junit.runners.Parameterized.Parameter; import org.junit.runners.Parameterized.Parameters; +import org.apache.hbase.thirdparty.com.google.common.io.Closeables; + @RunWith(Parameterized.class) @Category({ MediumTests.class, ClientTests.class }) public class TestAsyncTableScanMetrics { @@ -105,7 +106,7 @@ public class TestAsyncTableScanMetrics { @AfterClass public static void tearDown() throws Exception { - IOUtils.closeQuietly(CONN); + Closeables.close(CONN, true); UTIL.shutdownMiniCluster(); } diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestCatalogReplicaLoadBalanceSimpleSelector.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestCatalogReplicaLoadBalanceSimpleSelector.java index 6b14286f99c..a0b49b91a09 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestCatalogReplicaLoadBalanceSimpleSelector.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestCatalogReplicaLoadBalanceSimpleSelector.java @@ -21,9 +21,9 @@ import static org.apache.hadoop.hbase.HConstants.EMPTY_START_ROW; import static org.apache.hadoop.hbase.TableName.META_TABLE_NAME; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotEquals; + import java.io.IOException; import java.util.concurrent.TimeUnit; -import org.apache.commons.io.IOUtils; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.hbase.HBaseClassTestRule; import org.apache.hadoop.hbase.HBaseTestingUtility; @@ -40,6 +40,8 @@ import org.junit.experimental.categories.Category; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.apache.hbase.thirdparty.com.google.common.io.Closeables; + @Category({ MediumTests.class, ClientTests.class }) public class TestCatalogReplicaLoadBalanceSimpleSelector { @@ -80,7 +82,7 @@ public class TestCatalogReplicaLoadBalanceSimpleSelector { @AfterClass public static void tearDown() throws Exception { - IOUtils.closeQuietly(CONN); + Closeables.close(CONN, true); TEST_UTIL.shutdownMiniCluster(); } diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestMetaRegionLocationCache.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestMetaRegionLocationCache.java index 2bcddc9ea7f..24e88234048 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestMetaRegionLocationCache.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestMetaRegionLocationCache.java @@ -23,7 +23,6 @@ import static org.junit.Assert.assertFalse; import java.util.ArrayList; import java.util.Collections; import java.util.List; -import org.apache.commons.io.IOUtils; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.hbase.HBaseClassTestRule; import org.apache.hadoop.hbase.HBaseTestingUtility; @@ -48,6 +47,8 @@ import org.junit.ClassRule; import org.junit.Test; import org.junit.experimental.categories.Category; +import org.apache.hbase.thirdparty.com.google.common.io.Closeables; + @Category({SmallTests.class, MasterTests.class }) public class TestMetaRegionLocationCache { @ClassRule @@ -68,7 +69,7 @@ public class TestMetaRegionLocationCache { @AfterClass public static void cleanUp() throws Exception { - IOUtils.closeQuietly(REGISTRY); + Closeables.close(REGISTRY, true); TEST_UTIL.shutdownMiniCluster(); } diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestZKConnectionRegistry.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestZKConnectionRegistry.java index ac0e1935589..82cf0f9bbc9 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestZKConnectionRegistry.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/client/TestZKConnectionRegistry.java @@ -28,7 +28,6 @@ import static org.junit.Assert.fail; import java.io.IOException; import java.util.concurrent.ExecutionException; import java.util.stream.IntStream; -import org.apache.commons.io.IOUtils; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.hbase.HBaseClassTestRule; import org.apache.hadoop.hbase.HBaseTestingUtility; @@ -48,6 +47,8 @@ import org.junit.experimental.categories.Category; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.apache.hbase.thirdparty.com.google.common.io.Closeables; + @Category({ MediumTests.class, ClientTests.class }) public class TestZKConnectionRegistry { @@ -69,7 +70,7 @@ public class TestZKConnectionRegistry { @AfterClass public static void tearDown() throws Exception { - IOUtils.closeQuietly(REGISTRY); + Closeables.close(REGISTRY, true); TEST_UTIL.shutdownMiniCluster(); } diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestMasterOperationsForRegionReplicas.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestMasterOperationsForRegionReplicas.java index 01d482c095f..ad08e3fa556 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestMasterOperationsForRegionReplicas.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/master/TestMasterOperationsForRegionReplicas.java @@ -33,7 +33,6 @@ import java.util.List; import java.util.Map; import java.util.Set; import java.util.concurrent.atomic.AtomicInteger; -import org.apache.commons.io.IOUtils; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.hbase.CatalogFamilyFormat; import org.apache.hadoop.hbase.ClientMetaTableAccessor; @@ -107,7 +106,8 @@ public class TestMasterOperationsForRegionReplicas { } private static void resetConnections() throws IOException { - IOUtils.closeQuietly(ADMIN, CONNECTION); + Closeables.close(ADMIN, true); + Closeables.close(CONNECTION, true); CONNECTION = ConnectionFactory.createConnection(TEST_UTIL.getConfiguration()); ADMIN = CONNECTION.getAdmin(); } diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestEndToEndSplitTransaction.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestEndToEndSplitTransaction.java index c01edaa0467..48ad276af59 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestEndToEndSplitTransaction.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestEndToEndSplitTransaction.java @@ -30,7 +30,6 @@ import java.util.Random; import java.util.Set; import java.util.TreeSet; import java.util.stream.Collectors; -import org.apache.commons.io.IOUtils; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.hbase.CatalogFamilyFormat; import org.apache.hadoop.hbase.ChoreService; @@ -306,24 +305,15 @@ public class TestEndToEndSplitTransaction { /** verify region boundaries obtained from HTable.getStartEndKeys() */ void verifyRegionsUsingHTable() throws IOException { - Table table = null; - try { - // HTable.getStartEndKeys() - table = connection.getTable(tableName); + try (RegionLocator rl = connection.getRegionLocator(tableName)) { + Pair keys = rl.getStartEndKeys(); + verifyStartEndKeys(keys); - try (RegionLocator rl = connection.getRegionLocator(tableName)) { - Pair keys = rl.getStartEndKeys(); - verifyStartEndKeys(keys); - - Set regions = new TreeSet<>(RegionInfo.COMPARATOR); - for (HRegionLocation loc : rl.getAllRegionLocations()) { - regions.add(loc.getRegion()); - } - verifyTableRegions(regions); + Set regions = new TreeSet<>(RegionInfo.COMPARATOR); + for (HRegionLocation loc : rl.getAllRegionLocations()) { + regions.add(loc.getRegion()); } - - } finally { - IOUtils.closeQuietly(table); + verifyTableRegions(regions); } } diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestSplitTransactionOnCluster.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestSplitTransactionOnCluster.java index 98e8c9ee2dc..f11544f6a7a 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestSplitTransactionOnCluster.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/regionserver/TestSplitTransactionOnCluster.java @@ -38,7 +38,6 @@ import java.util.concurrent.ExecutionException; import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeoutException; import java.util.concurrent.atomic.AtomicBoolean; -import org.apache.commons.io.IOUtils; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.fs.FileSystem; import org.apache.hadoop.fs.Path; @@ -116,6 +115,7 @@ import org.mockito.Mockito; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.apache.hbase.thirdparty.com.google.common.io.Closeables; import org.apache.hbase.thirdparty.com.google.protobuf.RpcController; import org.apache.hbase.thirdparty.com.google.protobuf.ServiceException; @@ -900,7 +900,7 @@ public class TestSplitTransactionOnCluster { HMaster master = cluster.startMaster().getMaster(); cluster.waitForActiveAndReadyMaster(); // reset the connections - IOUtils.closeQuietly(admin); + Closeables.close(admin, true); TESTING_UTIL.invalidateConnection(); admin = TESTING_UTIL.getAdmin(); return master; diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestReplicationBase.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestReplicationBase.java index 455b2729815..eca0d675cb7 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestReplicationBase.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestReplicationBase.java @@ -20,10 +20,10 @@ package org.apache.hadoop.hbase.replication; import static org.junit.Assert.assertArrayEquals; import static org.junit.Assert.assertEquals; import static org.junit.Assert.fail; + import java.io.IOException; import java.util.ArrayList; import java.util.List; -import org.apache.commons.io.IOUtils; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.fs.FileSystem; import org.apache.hadoop.fs.Path; @@ -53,8 +53,10 @@ import org.junit.Before; import org.junit.BeforeClass; import org.slf4j.Logger; import org.slf4j.LoggerFactory; + import org.apache.hbase.thirdparty.com.google.common.collect.ImmutableList; import org.apache.hbase.thirdparty.com.google.common.collect.ImmutableMap; +import org.apache.hbase.thirdparty.com.google.common.io.Closeables; /** * This class is only a base for other integration-level replication tests. @@ -209,9 +211,9 @@ public class TestReplicationBase { conf2.setBoolean("hbase.tests.use.shortcircuit.reads", false); } - static void restartSourceCluster(int numSlaves) - throws Exception { - IOUtils.closeQuietly(hbaseAdmin, htable1); + static void restartSourceCluster(int numSlaves) throws Exception { + Closeables.close(hbaseAdmin, true); + Closeables.close(htable1, true); UTIL1.shutdownMiniHBaseCluster(); UTIL1.restartHBaseCluster(numSlaves); // Invalidate the cached connection state. @@ -222,7 +224,7 @@ public class TestReplicationBase { } static void restartTargetHBaseCluster(int numSlaves) throws Exception { - IOUtils.closeQuietly(htable2); + Closeables.close(htable2, true); UTIL2.restartHBaseCluster(numSlaves); // Invalidate the cached connection state CONF2 = UTIL2.getConfiguration(); diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestReplicationSyncUpToolBase.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestReplicationSyncUpToolBase.java index ee5276de7ee..3a45c5bdb9e 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestReplicationSyncUpToolBase.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/TestReplicationSyncUpToolBase.java @@ -19,7 +19,6 @@ package org.apache.hadoop.hbase.replication; import static org.apache.hadoop.hbase.HConstants.REPLICATION_SCOPE_GLOBAL; -import org.apache.commons.io.IOUtils; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.hbase.HBaseTestingUtility; import org.apache.hadoop.hbase.TableName; @@ -143,24 +142,28 @@ public abstract class TestReplicationSyncUpToolBase { // Utilities that manager shutdown / restart of source / sink clusters. They take care of // invalidating stale connections after shutdown / restarts. final void shutDownSourceHBaseCluster() throws Exception { - IOUtils.closeQuietly(ht1Source, ht2Source); + Closeables.close(ht1Source, true); + Closeables.close(ht2Source, true); UTIL1.shutdownMiniHBaseCluster(); } final void shutDownTargetHBaseCluster() throws Exception { - IOUtils.closeQuietly(ht1TargetAtPeer1, ht2TargetAtPeer1); + Closeables.close(ht1TargetAtPeer1, true); + Closeables.close(ht2TargetAtPeer1, true); UTIL2.shutdownMiniHBaseCluster(); } final void restartSourceHBaseCluster(int numServers) throws Exception { - IOUtils.closeQuietly(ht1Source, ht2Source); + Closeables.close(ht1Source, true); + Closeables.close(ht2Source, true); UTIL1.restartHBaseCluster(numServers); ht1Source = UTIL1.getConnection().getTable(TN1); ht2Source = UTIL1.getConnection().getTable(TN2); } final void restartTargetHBaseCluster(int numServers) throws Exception { - IOUtils.closeQuietly(ht1TargetAtPeer1, ht2TargetAtPeer1); + Closeables.close(ht1TargetAtPeer1, true); + Closeables.close(ht2TargetAtPeer1, true); UTIL2.restartHBaseCluster(numServers); ht1TargetAtPeer1 = UTIL2.getConnection().getTable(TN1); ht2TargetAtPeer1 = UTIL2.getConnection().getTable(TN2); diff --git a/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/regionserver/TestSerialReplicationEndpoint.java b/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/regionserver/TestSerialReplicationEndpoint.java index 090129174cc..3ba26f321b0 100644 --- a/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/regionserver/TestSerialReplicationEndpoint.java +++ b/hbase-server/src/test/java/org/apache/hadoop/hbase/replication/regionserver/TestSerialReplicationEndpoint.java @@ -25,8 +25,6 @@ import java.util.List; import java.util.concurrent.BlockingQueue; import java.util.concurrent.Callable; import java.util.concurrent.LinkedBlockingQueue; - -import org.apache.commons.io.IOUtils; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.hbase.Cell; import org.apache.hadoop.hbase.HBaseClassTestRule; @@ -56,6 +54,7 @@ import org.junit.experimental.categories.Category; import org.apache.hbase.thirdparty.com.google.common.collect.ImmutableList; import org.apache.hbase.thirdparty.com.google.common.collect.ImmutableMap; +import org.apache.hbase.thirdparty.com.google.common.io.Closeables; @Category({ ReplicationTests.class, MediumTests.class }) public class TestSerialReplicationEndpoint { @@ -78,7 +77,7 @@ public class TestSerialReplicationEndpoint { @AfterClass public static void tearDown() throws Exception { - IOUtils.closeQuietly(CONN); + Closeables.close(CONN, true); UTIL.shutdownMiniCluster(); } diff --git a/pom.xml b/pom.xml index f23d0db549b..749ab83842b 100755 --- a/pom.xml +++ b/pom.xml @@ -1611,7 +1611,7 @@ 1.13 1.6 - 2.6 + 2.8.0 3.9 3.6.1 3.4.2