HBASE-25451 Upgrade commons-io to 2.8.0 (#2825)

Signed-off-by: Guanghao Zhang <zghao@apache.org>
Signed-off-by: stack <stack@apache.org>
This commit is contained in:
Duo Zhang 2020-12-31 16:57:27 +08:00 committed by GitHub
parent 29a9a16de4
commit fbf00f9c28
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
31 changed files with 113 additions and 90 deletions

View File

@ -212,9 +212,10 @@ class AsyncConnectionImpl implements AsyncConnection {
if(LOG.isDebugEnabled()){ if(LOG.isDebugEnabled()){
logCallStack(Thread.currentThread().getStackTrace()); logCallStack(Thread.currentThread().getStackTrace());
} }
IOUtils.closeQuietly(clusterStatusListener); IOUtils.closeQuietly(clusterStatusListener,
IOUtils.closeQuietly(rpcClient); e -> LOG.warn("failed to close clusterStatusListener", e));
IOUtils.closeQuietly(registry); 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) { if (choreService != null) {
choreService.shutdown(); choreService.shutdown();
} }

View File

@ -111,7 +111,7 @@ public class AsyncClientExample extends Configured implements Tool {
CompletableFuture<Void> closeFuture = new CompletableFuture<>(); CompletableFuture<Void> closeFuture = new CompletableFuture<>();
addListener(f, (conn, error) -> { addListener(f, (conn, error) -> {
if (error == null) { if (error == null) {
IOUtils.closeQuietly(conn); IOUtils.closeQuietly(conn, e -> LOG.warn("failed to close conn", e));
} }
closeFuture.complete(null); closeFuture.complete(null);
}); });

View File

@ -21,8 +21,6 @@ import java.io.Closeable;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicInteger;
import org.apache.commons.io.IOUtils;
import org.apache.hadoop.fs.CanUnbuffer; import org.apache.hadoop.fs.CanUnbuffer;
import org.apache.hadoop.fs.FSDataInputStream; import org.apache.hadoop.fs.FSDataInputStream;
import org.apache.hadoop.fs.FileSystem; import org.apache.hadoop.fs.FileSystem;
@ -33,6 +31,8 @@ import org.apache.yetus.audience.InterfaceAudience;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; 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, * 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; * 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); updateInputStreamStatistics(this.streamNoFsChecksum);
// we do not care about the close exception as it is for reading, no data loss issue. // 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); updateInputStreamStatistics(stream);
IOUtils.closeQuietly(stream); Closeables.closeQuietly(stream);
} }
public HFileSystem getHfs() { public HFileSystem getHfs() {

View File

@ -505,7 +505,8 @@ public final class HFile {
throw new IllegalArgumentException("Invalid HFile version " + trailer.getMajorVersion()); throw new IllegalArgumentException("Invalid HFile version " + trailer.getMajorVersion());
} }
} catch (Throwable t) { } 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 " throw new CorruptHFileException("Problem reading HFile Trailer from file "
+ context.getFilePath(), t); + context.getFilePath(), t);
} finally { } finally {

View File

@ -44,7 +44,11 @@ import org.apache.hadoop.hbase.protobuf.ProtobufMagic;
import org.apache.hadoop.hbase.security.EncryptionUtil; import org.apache.hadoop.hbase.security.EncryptionUtil;
import org.apache.hadoop.hbase.util.Bytes; import org.apache.hadoop.hbase.util.Bytes;
import org.apache.yetus.audience.InterfaceAudience; 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.hbase.thirdparty.com.google.protobuf.UnsafeByteOperations;
import org.apache.hadoop.hbase.shaded.protobuf.ProtobufUtil; 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;
import org.apache.hadoop.hbase.shaded.protobuf.generated.HBaseProtos.BytesBytesPair; 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 @InterfaceAudience.Private
public class HFileInfo implements SortedMap<byte[], byte[]> { public class HFileInfo implements SortedMap<byte[], byte[]> {
private static final Logger LOG = LoggerFactory.getLogger(HFileInfo.class);
static final String RESERVED_PREFIX = "hfile."; static final String RESERVED_PREFIX = "hfile.";
static final byte[] RESERVED_PREFIX_BYTES = Bytes.toBytes(RESERVED_PREFIX); static final byte[] RESERVED_PREFIX_BYTES = Bytes.toBytes(RESERVED_PREFIX);
static final byte [] LASTKEY = Bytes.toBytes(RESERVED_PREFIX + "LASTKEY"); static final byte [] LASTKEY = Bytes.toBytes(RESERVED_PREFIX + "LASTKEY");
@ -344,7 +351,8 @@ public class HFileInfo implements SortedMap<byte[], byte[]> {
this.hfileContext = createHFileContext(path, trailer, conf); this.hfileContext = createHFileContext(path, trailer, conf);
context.getInputStreamWrapper().unbuffer(); context.getInputStreamWrapper().unbuffer();
} catch (Throwable t) { } 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 " throw new CorruptHFileException("Problem reading HFile Trailer from file "
+ context.getFilePath(), t); + context.getFilePath(), t);
} }
@ -382,9 +390,10 @@ public class HFileInfo implements SortedMap<byte[], byte[]> {
// close the block reader // close the block reader
context.getInputStreamWrapper().unbuffer(); context.getInputStreamWrapper().unbuffer();
} catch (Throwable t) { } catch (Throwable t) {
IOUtils.closeQuietly(context.getInputStreamWrapper()); IOUtils.closeQuietly(context.getInputStreamWrapper(),
throw new CorruptHFileException("Problem reading data index and meta index from file " e -> LOG.warn("failed to close input stream wrapper", e));
+ context.getFilePath(), t); throw new CorruptHFileException(
"Problem reading data index and meta index from file " + context.getFilePath(), t);
} }
} }

View File

@ -51,7 +51,6 @@ import java.util.concurrent.atomic.AtomicInteger;
import java.util.regex.Pattern; import java.util.regex.Pattern;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServlet;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FSDataOutputStream; 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.Lists;
import org.apache.hbase.thirdparty.com.google.common.collect.Maps; 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.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.Descriptors;
import org.apache.hbase.thirdparty.com.google.protobuf.Service; import org.apache.hbase.thirdparty.com.google.protobuf.Service;
import org.apache.hbase.thirdparty.org.eclipse.jetty.server.Server; 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()); HBaseFsck.createLockRetryCounterFactory(this.conf).create());
} finally { } finally {
if (result != null) { if (result != null) {
IOUtils.closeQuietly(result.getSecond()); Closeables.close(result.getSecond(), true);
} }
} }
} }

View File

@ -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.base.Preconditions;
import org.apache.hbase.thirdparty.com.google.common.collect.Lists; 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.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.hbase.thirdparty.com.google.common.util.concurrent.ThreadFactoryBuilder;
import org.apache.yetus.audience.InterfaceAudience; import org.apache.yetus.audience.InterfaceAudience;
import org.apache.yetus.audience.InterfaceStability; import org.apache.yetus.audience.InterfaceStability;
@ -511,7 +512,7 @@ public class HBaseFsck extends Configured implements Closeable {
RetryCounter retryCounter = lockFileRetryCounterFactory.create(); RetryCounter retryCounter = lockFileRetryCounterFactory.create();
do { do {
try { try {
IOUtils.closeQuietly(hbckOutFd); Closeables.close(hbckOutFd, true);
CommonFSUtils.delete(CommonFSUtils.getCurrentFileSystem(getConf()), HBCK_LOCK_PATH, true); CommonFSUtils.delete(CommonFSUtils.getCurrentFileSystem(getConf()), HBCK_LOCK_PATH, true);
LOG.info("Finishing hbck"); LOG.info("Finishing hbck");
return; return;
@ -564,7 +565,7 @@ public class HBaseFsck extends Configured implements Closeable {
Runtime.getRuntime().addShutdownHook(new Thread() { Runtime.getRuntime().addShutdownHook(new Thread() {
@Override @Override
public void run() { public void run() {
IOUtils.closeQuietly(HBaseFsck.this); IOUtils.closeQuietly(HBaseFsck.this, e -> LOG.warn("", e));
cleanupHbckZnode(); cleanupHbckZnode();
unlockHbck(); unlockHbck();
} }
@ -863,9 +864,9 @@ public class HBaseFsck extends Configured implements Closeable {
zkw.close(); zkw.close();
zkw = null; zkw = null;
} }
IOUtils.closeQuietly(admin); IOUtils.closeQuietly(admin, e -> LOG.warn("", e));
IOUtils.closeQuietly(meta); IOUtils.closeQuietly(meta, e -> LOG.warn("", e));
IOUtils.closeQuietly(connection); IOUtils.closeQuietly(connection, e -> LOG.warn("", e));
} }
} }
@ -3845,7 +3846,7 @@ public class HBaseFsck extends Configured implements Closeable {
setRetCode(code); setRetCode(code);
} }
} finally { } finally {
IOUtils.closeQuietly(this); IOUtils.closeQuietly(this, e -> LOG.warn("", e));
} }
return this; return this;
} }

View File

@ -121,8 +121,8 @@ public class RegionMover extends AbstractHBaseTool implements Closeable {
@Override @Override
public void close() { public void close() {
IOUtils.closeQuietly(this.admin); IOUtils.closeQuietly(this.admin, e -> LOG.warn("failed to close admin", e));
IOUtils.closeQuietly(this.conn); IOUtils.closeQuietly(this.conn, e -> LOG.warn("failed to close conn", e));
} }
/** /**

View File

@ -28,7 +28,6 @@ import java.util.concurrent.ConcurrentMap;
import java.util.concurrent.ForkJoinPool; import java.util.concurrent.ForkJoinPool;
import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicInteger;
import java.util.function.Supplier; import java.util.function.Supplier;
import org.apache.commons.io.IOUtils;
import org.apache.hadoop.hbase.Cell; import org.apache.hadoop.hbase.Cell;
import org.apache.hadoop.hbase.HBaseTestingUtility; import org.apache.hadoop.hbase.HBaseTestingUtility;
import org.apache.hadoop.hbase.TableName; 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.Parameter;
import org.junit.runners.Parameterized.Parameters; import org.junit.runners.Parameterized.Parameters;
import org.apache.hbase.thirdparty.com.google.common.io.Closeables;
public abstract class AbstractTestAsyncTableRegionReplicasRead { public abstract class AbstractTestAsyncTableRegionReplicasRead {
protected static final HBaseTestingUtility TEST_UTIL = new HBaseTestingUtility(); protected static final HBaseTestingUtility TEST_UTIL = new HBaseTestingUtility();
@ -152,7 +153,7 @@ public abstract class AbstractTestAsyncTableRegionReplicasRead {
@AfterClass @AfterClass
public static void tearDownAfterClass() throws Exception { public static void tearDownAfterClass() throws Exception {
IOUtils.closeQuietly(ASYNC_CONN); Closeables.close(ASYNC_CONN, true);
TEST_UTIL.shutdownMiniCluster(); TEST_UTIL.shutdownMiniCluster();
} }

View File

@ -26,7 +26,6 @@ import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ForkJoinPool; import java.util.concurrent.ForkJoinPool;
import java.util.function.Supplier; import java.util.function.Supplier;
import java.util.regex.Pattern; import java.util.regex.Pattern;
import org.apache.commons.io.IOUtils;
import org.apache.hadoop.hbase.HBaseTestingUtility; import org.apache.hadoop.hbase.HBaseTestingUtility;
import org.apache.hadoop.hbase.HConstants; import org.apache.hadoop.hbase.HConstants;
import org.apache.hadoop.hbase.StartMiniClusterOption; import org.apache.hadoop.hbase.StartMiniClusterOption;
@ -43,6 +42,8 @@ import org.junit.runners.Parameterized.Parameters;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.apache.hbase.thirdparty.com.google.common.io.Closeables;
/** /**
* Class to test AsyncAdmin. * Class to test AsyncAdmin.
*/ */
@ -92,7 +93,7 @@ public abstract class TestAsyncAdminBase extends AbstractTestUpdateConfiguration
@AfterClass @AfterClass
public static void tearDownAfterClass() throws Exception { public static void tearDownAfterClass() throws Exception {
IOUtils.closeQuietly(ASYNC_CONN); Closeables.close(ASYNC_CONN, true);
TEST_UTIL.shutdownMiniCluster(); TEST_UTIL.shutdownMiniCluster();
} }

View File

@ -29,7 +29,6 @@ import java.util.concurrent.ForkJoinPool;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicLong; import java.util.concurrent.atomic.AtomicLong;
import java.util.function.Supplier; import java.util.function.Supplier;
import org.apache.commons.io.IOUtils;
import org.apache.hadoop.hbase.HBaseClassTestRule; import org.apache.hadoop.hbase.HBaseClassTestRule;
import org.apache.hadoop.hbase.HBaseTestingUtility; import org.apache.hadoop.hbase.HBaseTestingUtility;
import org.apache.hadoop.hbase.HConstants; import org.apache.hadoop.hbase.HConstants;
@ -53,6 +52,8 @@ import org.junit.runners.Parameterized.Parameters;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.apache.hbase.thirdparty.com.google.common.io.Closeables;
@RunWith(Parameterized.class) @RunWith(Parameterized.class)
@Category({ LargeTests.class, ClientTests.class }) @Category({ LargeTests.class, ClientTests.class })
public class TestAsyncAdminBuilder { public class TestAsyncAdminBuilder {
@ -98,7 +99,7 @@ public class TestAsyncAdminBuilder {
@After @After
public void tearDown() throws Exception { public void tearDown() throws Exception {
IOUtils.closeQuietly(ASYNC_CONN); Closeables.close(ASYNC_CONN, true);
TEST_UTIL.shutdownMiniCluster(); TEST_UTIL.shutdownMiniCluster();
} }

View File

@ -22,7 +22,6 @@ import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue; import static org.junit.Assert.assertTrue;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import org.apache.commons.io.IOUtils;
import org.apache.hadoop.hbase.HBaseClassTestRule; import org.apache.hadoop.hbase.HBaseClassTestRule;
import org.apache.hadoop.hbase.HConstants; import org.apache.hadoop.hbase.HConstants;
import org.apache.hadoop.hbase.master.HMaster; import org.apache.hadoop.hbase.master.HMaster;
@ -37,6 +36,8 @@ import org.junit.ClassRule;
import org.junit.Test; import org.junit.Test;
import org.junit.experimental.categories.Category; import org.junit.experimental.categories.Category;
import org.apache.hbase.thirdparty.com.google.common.io.Closeables;
/** /**
* Only used to test stopMaster/stopRegionServer/shutdown methods. * Only used to test stopMaster/stopRegionServer/shutdown methods.
*/ */
@ -71,7 +72,7 @@ public class TestAsyncClusterAdminApi2 extends TestAsyncAdminBase {
@After @After
@Override @Override
public void tearDown() throws Exception { public void tearDown() throws Exception {
IOUtils.closeQuietly(ASYNC_CONN); Closeables.close(ASYNC_CONN, true);
TEST_UTIL.shutdownMiniCluster(); TEST_UTIL.shutdownMiniCluster();
} }

View File

@ -19,7 +19,6 @@ package org.apache.hadoop.hbase.client;
import static org.apache.hadoop.hbase.client.RegionReplicaTestHelper.testLocator; 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.HBaseClassTestRule;
import org.apache.hadoop.hbase.HBaseTestingUtility; import org.apache.hadoop.hbase.HBaseTestingUtility;
import org.apache.hadoop.hbase.HRegionLocation; import org.apache.hadoop.hbase.HRegionLocation;
@ -34,6 +33,8 @@ import org.junit.ClassRule;
import org.junit.Test; import org.junit.Test;
import org.junit.experimental.categories.Category; import org.junit.experimental.categories.Category;
import org.apache.hbase.thirdparty.com.google.common.io.Closeables;
@Category({ MediumTests.class, ClientTests.class }) @Category({ MediumTests.class, ClientTests.class })
public class TestAsyncMetaRegionLocator { public class TestAsyncMetaRegionLocator {
@ -60,7 +61,7 @@ public class TestAsyncMetaRegionLocator {
@AfterClass @AfterClass
public static void tearDown() throws Exception { public static void tearDown() throws Exception {
IOUtils.closeQuietly(REGISTRY); Closeables.close(REGISTRY, true);
TEST_UTIL.shutdownMiniCluster(); TEST_UTIL.shutdownMiniCluster();
} }

View File

@ -35,7 +35,6 @@ import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ExecutionException; import java.util.concurrent.ExecutionException;
import java.util.concurrent.ThreadLocalRandom; import java.util.concurrent.ThreadLocalRandom;
import java.util.stream.IntStream; import java.util.stream.IntStream;
import org.apache.commons.io.IOUtils;
import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hbase.HBaseClassTestRule; import org.apache.hadoop.hbase.HBaseClassTestRule;
import org.apache.hadoop.hbase.HBaseTestingUtility; import org.apache.hadoop.hbase.HBaseTestingUtility;
@ -63,6 +62,8 @@ import org.junit.runners.Parameterized;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.apache.hbase.thirdparty.com.google.common.io.Closeables;
@Category({ MediumTests.class, ClientTests.class }) @Category({ MediumTests.class, ClientTests.class })
@RunWith(Parameterized.class) @RunWith(Parameterized.class)
public class TestAsyncNonMetaRegionLocator { public class TestAsyncNonMetaRegionLocator {
@ -116,7 +117,7 @@ public class TestAsyncNonMetaRegionLocator {
@AfterClass @AfterClass
public static void tearDown() throws Exception { public static void tearDown() throws Exception {
IOUtils.closeQuietly(CONN); Closeables.close(CONN, true);
TEST_UTIL.shutdownMiniCluster(); TEST_UTIL.shutdownMiniCluster();
} }

View File

@ -32,7 +32,6 @@ import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ExecutionException; import java.util.concurrent.ExecutionException;
import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicInteger;
import java.util.stream.IntStream; import java.util.stream.IntStream;
import org.apache.commons.io.IOUtils;
import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hbase.HBaseClassTestRule; import org.apache.hadoop.hbase.HBaseClassTestRule;
import org.apache.hadoop.hbase.HBaseTestingUtility; import org.apache.hadoop.hbase.HBaseTestingUtility;
@ -55,6 +54,8 @@ import org.junit.ClassRule;
import org.junit.Test; import org.junit.Test;
import org.junit.experimental.categories.Category; import org.junit.experimental.categories.Category;
import org.apache.hbase.thirdparty.com.google.common.io.Closeables;
@Category({ MediumTests.class, ClientTests.class }) @Category({ MediumTests.class, ClientTests.class })
public class TestAsyncNonMetaRegionLocatorConcurrenyLimit { public class TestAsyncNonMetaRegionLocatorConcurrenyLimit {
@ -136,7 +137,7 @@ public class TestAsyncNonMetaRegionLocatorConcurrenyLimit {
@AfterClass @AfterClass
public static void tearDown() throws Exception { public static void tearDown() throws Exception {
IOUtils.closeQuietly(CONN); Closeables.close(CONN, true);
TEST_UTIL.shutdownMiniCluster(); TEST_UTIL.shutdownMiniCluster();
} }

View File

@ -32,7 +32,6 @@ import java.util.concurrent.CompletionException;
import java.util.concurrent.ExecutionException; import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicReference; import java.util.concurrent.atomic.AtomicReference;
import org.apache.commons.io.IOUtils;
import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hbase.HBaseClassTestRule; import org.apache.hadoop.hbase.HBaseClassTestRule;
import org.apache.hadoop.hbase.HBaseTestingUtility; import org.apache.hadoop.hbase.HBaseTestingUtility;
@ -56,6 +55,8 @@ import org.junit.ClassRule;
import org.junit.Test; import org.junit.Test;
import org.junit.experimental.categories.Category; import org.junit.experimental.categories.Category;
import org.apache.hbase.thirdparty.com.google.common.io.Closeables;
@Category({ MediumTests.class, ClientTests.class }) @Category({ MediumTests.class, ClientTests.class })
public class TestAsyncRegionLocator { public class TestAsyncRegionLocator {
@ -107,7 +108,7 @@ public class TestAsyncRegionLocator {
@AfterClass @AfterClass
public static void tearDown() throws Exception { public static void tearDown() throws Exception {
IOUtils.closeQuietly(CONN); Closeables.close(CONN, true);
TEST_UTIL.shutdownMiniCluster(); TEST_UTIL.shutdownMiniCluster();
} }

View File

@ -29,7 +29,6 @@ import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicInteger;
import org.apache.commons.io.IOUtils;
import org.apache.hadoop.hbase.HBaseClassTestRule; import org.apache.hadoop.hbase.HBaseClassTestRule;
import org.apache.hadoop.hbase.HBaseTestingUtility; import org.apache.hadoop.hbase.HBaseTestingUtility;
import org.apache.hadoop.hbase.HRegionLocation; import org.apache.hadoop.hbase.HRegionLocation;
@ -44,6 +43,8 @@ import org.junit.ClassRule;
import org.junit.Test; import org.junit.Test;
import org.junit.experimental.categories.Category; import org.junit.experimental.categories.Category;
import org.apache.hbase.thirdparty.com.google.common.io.Closeables;
@Category({ MediumTests.class, ClientTests.class }) @Category({ MediumTests.class, ClientTests.class })
public class TestAsyncSingleRequestRpcRetryingCaller { public class TestAsyncSingleRequestRpcRetryingCaller {
@ -79,7 +80,7 @@ public class TestAsyncSingleRequestRpcRetryingCaller {
@AfterClass @AfterClass
public static void tearDownAfterClass() throws Exception { public static void tearDownAfterClass() throws Exception {
IOUtils.closeQuietly(CONN); Closeables.close(CONN, true);
TEST_UTIL.shutdownMiniCluster(); TEST_UTIL.shutdownMiniCluster();
} }

View File

@ -41,7 +41,6 @@ import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.atomic.AtomicLong; import java.util.concurrent.atomic.AtomicLong;
import java.util.function.Supplier; import java.util.function.Supplier;
import java.util.stream.IntStream; import java.util.stream.IntStream;
import org.apache.commons.io.IOUtils;
import org.apache.hadoop.hbase.CompareOperator; import org.apache.hadoop.hbase.CompareOperator;
import org.apache.hadoop.hbase.HBaseClassTestRule; import org.apache.hadoop.hbase.HBaseClassTestRule;
import org.apache.hadoop.hbase.HBaseTestingUtility; 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.Parameter;
import org.junit.runners.Parameterized.Parameters; import org.junit.runners.Parameterized.Parameters;
import org.apache.hbase.thirdparty.com.google.common.io.Closeables;
@RunWith(Parameterized.class) @RunWith(Parameterized.class)
@Category({ MediumTests.class, ClientTests.class }) @Category({ MediumTests.class, ClientTests.class })
public class TestAsyncTable { public class TestAsyncTable {
@ -128,7 +129,7 @@ public class TestAsyncTable {
@AfterClass @AfterClass
public static void tearDownAfterClass() throws Exception { public static void tearDownAfterClass() throws Exception {
IOUtils.closeQuietly(ASYNC_CONN); Closeables.close(ASYNC_CONN, true);
assertTrue(ASYNC_CONN.isClosed()); assertTrue(ASYNC_CONN.isClosed());
TEST_UTIL.shutdownMiniCluster(); TEST_UTIL.shutdownMiniCluster();
} }

View File

@ -21,7 +21,6 @@ import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue; import static org.junit.Assert.assertTrue;
import java.io.IOException; import java.io.IOException;
import org.apache.commons.io.IOUtils;
import org.apache.hadoop.hbase.HBaseClassTestRule; import org.apache.hadoop.hbase.HBaseClassTestRule;
import org.apache.hadoop.hbase.HBaseTestingUtility; import org.apache.hadoop.hbase.HBaseTestingUtility;
import org.apache.hadoop.hbase.TableName; import org.apache.hadoop.hbase.TableName;
@ -34,6 +33,8 @@ import org.junit.ClassRule;
import org.junit.Test; import org.junit.Test;
import org.junit.experimental.categories.Category; 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 * Fix an infinite loop in {@link AsyncNonMetaRegionLocator}, see the comments on HBASE-21943 for
* more details. * more details.
@ -69,7 +70,7 @@ public class TestAsyncTableLocateRegionForDeletedTable {
@AfterClass @AfterClass
public static void tearDownAfterClass() throws Exception { public static void tearDownAfterClass() throws Exception {
IOUtils.closeQuietly(ASYNC_CONN); Closeables.close(ASYNC_CONN, true);
assertTrue(ASYNC_CONN.isClosed()); assertTrue(ASYNC_CONN.isClosed());
TEST_UTIL.shutdownMiniCluster(); TEST_UTIL.shutdownMiniCluster();
} }

View File

@ -26,7 +26,6 @@ import java.util.Optional;
import java.util.concurrent.ExecutionException; import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicInteger;
import org.apache.commons.io.IOUtils;
import org.apache.hadoop.hbase.HBaseClassTestRule; import org.apache.hadoop.hbase.HBaseClassTestRule;
import org.apache.hadoop.hbase.HBaseTestingUtility; import org.apache.hadoop.hbase.HBaseTestingUtility;
import org.apache.hadoop.hbase.TableName; import org.apache.hadoop.hbase.TableName;
@ -47,6 +46,8 @@ import org.junit.Test;
import org.junit.experimental.categories.Category; import org.junit.experimental.categories.Category;
import org.junit.rules.TestName; import org.junit.rules.TestName;
import org.apache.hbase.thirdparty.com.google.common.io.Closeables;
@Category({ MediumTests.class, ClientTests.class }) @Category({ MediumTests.class, ClientTests.class })
public class TestAsyncTableNoncedRetry { public class TestAsyncTableNoncedRetry {
@ -114,7 +115,7 @@ public class TestAsyncTableNoncedRetry {
@AfterClass @AfterClass
public static void tearDownAfterClass() throws Exception { public static void tearDownAfterClass() throws Exception {
IOUtils.closeQuietly(ASYNC_CONN); Closeables.close(ASYNC_CONN, true);
TEST_UTIL.shutdownMiniCluster(); TEST_UTIL.shutdownMiniCluster();
} }

View File

@ -25,7 +25,6 @@ import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.concurrent.ForkJoinPool; import java.util.concurrent.ForkJoinPool;
import org.apache.commons.io.IOUtils;
import org.apache.hadoop.hbase.HBaseClassTestRule; import org.apache.hadoop.hbase.HBaseClassTestRule;
import org.apache.hadoop.hbase.HBaseTestingUtility; import org.apache.hadoop.hbase.HBaseTestingUtility;
import org.apache.hadoop.hbase.PrivateCellUtil; 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.Parameter;
import org.junit.runners.Parameterized.Parameters; import org.junit.runners.Parameterized.Parameters;
import org.apache.hbase.thirdparty.com.google.common.io.Closeables;
@RunWith(Parameterized.class) @RunWith(Parameterized.class)
@Category({ MediumTests.class, ClientTests.class }) @Category({ MediumTests.class, ClientTests.class })
public class TestAsyncTableScanMetrics { public class TestAsyncTableScanMetrics {
@ -105,7 +106,7 @@ public class TestAsyncTableScanMetrics {
@AfterClass @AfterClass
public static void tearDown() throws Exception { public static void tearDown() throws Exception {
IOUtils.closeQuietly(CONN); Closeables.close(CONN, true);
UTIL.shutdownMiniCluster(); UTIL.shutdownMiniCluster();
} }

View File

@ -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.apache.hadoop.hbase.TableName.META_TABLE_NAME;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotEquals; import static org.junit.Assert.assertNotEquals;
import java.io.IOException; import java.io.IOException;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import org.apache.commons.io.IOUtils;
import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hbase.HBaseClassTestRule; import org.apache.hadoop.hbase.HBaseClassTestRule;
import org.apache.hadoop.hbase.HBaseTestingUtility; import org.apache.hadoop.hbase.HBaseTestingUtility;
@ -40,6 +40,8 @@ import org.junit.experimental.categories.Category;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.apache.hbase.thirdparty.com.google.common.io.Closeables;
@Category({ MediumTests.class, ClientTests.class }) @Category({ MediumTests.class, ClientTests.class })
public class TestCatalogReplicaLoadBalanceSimpleSelector { public class TestCatalogReplicaLoadBalanceSimpleSelector {
@ -80,7 +82,7 @@ public class TestCatalogReplicaLoadBalanceSimpleSelector {
@AfterClass @AfterClass
public static void tearDown() throws Exception { public static void tearDown() throws Exception {
IOUtils.closeQuietly(CONN); Closeables.close(CONN, true);
TEST_UTIL.shutdownMiniCluster(); TEST_UTIL.shutdownMiniCluster();
} }

View File

@ -23,7 +23,6 @@ import static org.junit.Assert.assertFalse;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import org.apache.commons.io.IOUtils;
import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hbase.HBaseClassTestRule; import org.apache.hadoop.hbase.HBaseClassTestRule;
import org.apache.hadoop.hbase.HBaseTestingUtility; import org.apache.hadoop.hbase.HBaseTestingUtility;
@ -48,6 +47,8 @@ import org.junit.ClassRule;
import org.junit.Test; import org.junit.Test;
import org.junit.experimental.categories.Category; import org.junit.experimental.categories.Category;
import org.apache.hbase.thirdparty.com.google.common.io.Closeables;
@Category({SmallTests.class, MasterTests.class }) @Category({SmallTests.class, MasterTests.class })
public class TestMetaRegionLocationCache { public class TestMetaRegionLocationCache {
@ClassRule @ClassRule
@ -68,7 +69,7 @@ public class TestMetaRegionLocationCache {
@AfterClass @AfterClass
public static void cleanUp() throws Exception { public static void cleanUp() throws Exception {
IOUtils.closeQuietly(REGISTRY); Closeables.close(REGISTRY, true);
TEST_UTIL.shutdownMiniCluster(); TEST_UTIL.shutdownMiniCluster();
} }

View File

@ -28,7 +28,6 @@ import static org.junit.Assert.fail;
import java.io.IOException; import java.io.IOException;
import java.util.concurrent.ExecutionException; import java.util.concurrent.ExecutionException;
import java.util.stream.IntStream; import java.util.stream.IntStream;
import org.apache.commons.io.IOUtils;
import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hbase.HBaseClassTestRule; import org.apache.hadoop.hbase.HBaseClassTestRule;
import org.apache.hadoop.hbase.HBaseTestingUtility; import org.apache.hadoop.hbase.HBaseTestingUtility;
@ -48,6 +47,8 @@ import org.junit.experimental.categories.Category;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.apache.hbase.thirdparty.com.google.common.io.Closeables;
@Category({ MediumTests.class, ClientTests.class }) @Category({ MediumTests.class, ClientTests.class })
public class TestZKConnectionRegistry { public class TestZKConnectionRegistry {
@ -69,7 +70,7 @@ public class TestZKConnectionRegistry {
@AfterClass @AfterClass
public static void tearDown() throws Exception { public static void tearDown() throws Exception {
IOUtils.closeQuietly(REGISTRY); Closeables.close(REGISTRY, true);
TEST_UTIL.shutdownMiniCluster(); TEST_UTIL.shutdownMiniCluster();
} }

View File

@ -33,7 +33,6 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicInteger;
import org.apache.commons.io.IOUtils;
import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hbase.CatalogFamilyFormat; import org.apache.hadoop.hbase.CatalogFamilyFormat;
import org.apache.hadoop.hbase.ClientMetaTableAccessor; import org.apache.hadoop.hbase.ClientMetaTableAccessor;
@ -107,7 +106,8 @@ public class TestMasterOperationsForRegionReplicas {
} }
private static void resetConnections() throws IOException { private static void resetConnections() throws IOException {
IOUtils.closeQuietly(ADMIN, CONNECTION); Closeables.close(ADMIN, true);
Closeables.close(CONNECTION, true);
CONNECTION = ConnectionFactory.createConnection(TEST_UTIL.getConfiguration()); CONNECTION = ConnectionFactory.createConnection(TEST_UTIL.getConfiguration());
ADMIN = CONNECTION.getAdmin(); ADMIN = CONNECTION.getAdmin();
} }

View File

@ -30,7 +30,6 @@ import java.util.Random;
import java.util.Set; import java.util.Set;
import java.util.TreeSet; import java.util.TreeSet;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import org.apache.commons.io.IOUtils;
import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hbase.CatalogFamilyFormat; import org.apache.hadoop.hbase.CatalogFamilyFormat;
import org.apache.hadoop.hbase.ChoreService; import org.apache.hadoop.hbase.ChoreService;
@ -306,11 +305,6 @@ public class TestEndToEndSplitTransaction {
/** verify region boundaries obtained from HTable.getStartEndKeys() */ /** verify region boundaries obtained from HTable.getStartEndKeys() */
void verifyRegionsUsingHTable() throws IOException { void verifyRegionsUsingHTable() throws IOException {
Table table = null;
try {
// HTable.getStartEndKeys()
table = connection.getTable(tableName);
try (RegionLocator rl = connection.getRegionLocator(tableName)) { try (RegionLocator rl = connection.getRegionLocator(tableName)) {
Pair<byte[][], byte[][]> keys = rl.getStartEndKeys(); Pair<byte[][], byte[][]> keys = rl.getStartEndKeys();
verifyStartEndKeys(keys); verifyStartEndKeys(keys);
@ -321,10 +315,6 @@ public class TestEndToEndSplitTransaction {
} }
verifyTableRegions(regions); verifyTableRegions(regions);
} }
} finally {
IOUtils.closeQuietly(table);
}
} }
void verify() throws Exception { void verify() throws Exception {

View File

@ -38,7 +38,6 @@ import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException; import java.util.concurrent.TimeoutException;
import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicBoolean;
import org.apache.commons.io.IOUtils;
import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FileSystem; import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path; import org.apache.hadoop.fs.Path;
@ -116,6 +115,7 @@ import org.mockito.Mockito;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; 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.RpcController;
import org.apache.hbase.thirdparty.com.google.protobuf.ServiceException; import org.apache.hbase.thirdparty.com.google.protobuf.ServiceException;
@ -900,7 +900,7 @@ public class TestSplitTransactionOnCluster {
HMaster master = cluster.startMaster().getMaster(); HMaster master = cluster.startMaster().getMaster();
cluster.waitForActiveAndReadyMaster(); cluster.waitForActiveAndReadyMaster();
// reset the connections // reset the connections
IOUtils.closeQuietly(admin); Closeables.close(admin, true);
TESTING_UTIL.invalidateConnection(); TESTING_UTIL.invalidateConnection();
admin = TESTING_UTIL.getAdmin(); admin = TESTING_UTIL.getAdmin();
return master; return master;

View File

@ -20,10 +20,10 @@ package org.apache.hadoop.hbase.replication;
import static org.junit.Assert.assertArrayEquals; import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertEquals;
import static org.junit.Assert.fail; import static org.junit.Assert.fail;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import org.apache.commons.io.IOUtils;
import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FileSystem; import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path; import org.apache.hadoop.fs.Path;
@ -53,8 +53,10 @@ import org.junit.Before;
import org.junit.BeforeClass; import org.junit.BeforeClass;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.apache.hbase.thirdparty.com.google.common.collect.ImmutableList; 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.collect.ImmutableMap;
import org.apache.hbase.thirdparty.com.google.common.io.Closeables;
/** /**
* This class is only a base for other integration-level replication tests. * 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); conf2.setBoolean("hbase.tests.use.shortcircuit.reads", false);
} }
static void restartSourceCluster(int numSlaves) static void restartSourceCluster(int numSlaves) throws Exception {
throws Exception { Closeables.close(hbaseAdmin, true);
IOUtils.closeQuietly(hbaseAdmin, htable1); Closeables.close(htable1, true);
UTIL1.shutdownMiniHBaseCluster(); UTIL1.shutdownMiniHBaseCluster();
UTIL1.restartHBaseCluster(numSlaves); UTIL1.restartHBaseCluster(numSlaves);
// Invalidate the cached connection state. // Invalidate the cached connection state.
@ -222,7 +224,7 @@ public class TestReplicationBase {
} }
static void restartTargetHBaseCluster(int numSlaves) throws Exception { static void restartTargetHBaseCluster(int numSlaves) throws Exception {
IOUtils.closeQuietly(htable2); Closeables.close(htable2, true);
UTIL2.restartHBaseCluster(numSlaves); UTIL2.restartHBaseCluster(numSlaves);
// Invalidate the cached connection state // Invalidate the cached connection state
CONF2 = UTIL2.getConfiguration(); CONF2 = UTIL2.getConfiguration();

View File

@ -19,7 +19,6 @@ package org.apache.hadoop.hbase.replication;
import static org.apache.hadoop.hbase.HConstants.REPLICATION_SCOPE_GLOBAL; 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.conf.Configuration;
import org.apache.hadoop.hbase.HBaseTestingUtility; import org.apache.hadoop.hbase.HBaseTestingUtility;
import org.apache.hadoop.hbase.TableName; 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 // Utilities that manager shutdown / restart of source / sink clusters. They take care of
// invalidating stale connections after shutdown / restarts. // invalidating stale connections after shutdown / restarts.
final void shutDownSourceHBaseCluster() throws Exception { final void shutDownSourceHBaseCluster() throws Exception {
IOUtils.closeQuietly(ht1Source, ht2Source); Closeables.close(ht1Source, true);
Closeables.close(ht2Source, true);
UTIL1.shutdownMiniHBaseCluster(); UTIL1.shutdownMiniHBaseCluster();
} }
final void shutDownTargetHBaseCluster() throws Exception { final void shutDownTargetHBaseCluster() throws Exception {
IOUtils.closeQuietly(ht1TargetAtPeer1, ht2TargetAtPeer1); Closeables.close(ht1TargetAtPeer1, true);
Closeables.close(ht2TargetAtPeer1, true);
UTIL2.shutdownMiniHBaseCluster(); UTIL2.shutdownMiniHBaseCluster();
} }
final void restartSourceHBaseCluster(int numServers) throws Exception { final void restartSourceHBaseCluster(int numServers) throws Exception {
IOUtils.closeQuietly(ht1Source, ht2Source); Closeables.close(ht1Source, true);
Closeables.close(ht2Source, true);
UTIL1.restartHBaseCluster(numServers); UTIL1.restartHBaseCluster(numServers);
ht1Source = UTIL1.getConnection().getTable(TN1); ht1Source = UTIL1.getConnection().getTable(TN1);
ht2Source = UTIL1.getConnection().getTable(TN2); ht2Source = UTIL1.getConnection().getTable(TN2);
} }
final void restartTargetHBaseCluster(int numServers) throws Exception { final void restartTargetHBaseCluster(int numServers) throws Exception {
IOUtils.closeQuietly(ht1TargetAtPeer1, ht2TargetAtPeer1); Closeables.close(ht1TargetAtPeer1, true);
Closeables.close(ht2TargetAtPeer1, true);
UTIL2.restartHBaseCluster(numServers); UTIL2.restartHBaseCluster(numServers);
ht1TargetAtPeer1 = UTIL2.getConnection().getTable(TN1); ht1TargetAtPeer1 = UTIL2.getConnection().getTable(TN1);
ht2TargetAtPeer1 = UTIL2.getConnection().getTable(TN2); ht2TargetAtPeer1 = UTIL2.getConnection().getTable(TN2);

View File

@ -25,8 +25,6 @@ import java.util.List;
import java.util.concurrent.BlockingQueue; import java.util.concurrent.BlockingQueue;
import java.util.concurrent.Callable; import java.util.concurrent.Callable;
import java.util.concurrent.LinkedBlockingQueue; import java.util.concurrent.LinkedBlockingQueue;
import org.apache.commons.io.IOUtils;
import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.hbase.Cell; import org.apache.hadoop.hbase.Cell;
import org.apache.hadoop.hbase.HBaseClassTestRule; 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.ImmutableList;
import org.apache.hbase.thirdparty.com.google.common.collect.ImmutableMap; 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 }) @Category({ ReplicationTests.class, MediumTests.class })
public class TestSerialReplicationEndpoint { public class TestSerialReplicationEndpoint {
@ -78,7 +77,7 @@ public class TestSerialReplicationEndpoint {
@AfterClass @AfterClass
public static void tearDown() throws Exception { public static void tearDown() throws Exception {
IOUtils.closeQuietly(CONN); Closeables.close(CONN, true);
UTIL.shutdownMiniCluster(); UTIL.shutdownMiniCluster();
} }

View File

@ -1611,7 +1611,7 @@
<commons-codec.version>1.13</commons-codec.version> <commons-codec.version>1.13</commons-codec.version>
<commons-validator.version>1.6</commons-validator.version> <commons-validator.version>1.6</commons-validator.version>
<!-- pretty outdated --> <!-- pretty outdated -->
<commons-io.version>2.6</commons-io.version> <commons-io.version>2.8.0</commons-io.version>
<commons-lang3.version>3.9</commons-lang3.version> <commons-lang3.version>3.9</commons-lang3.version>
<commons-math.version>3.6.1</commons-math.version> <commons-math.version>3.6.1</commons-math.version>
<disruptor.version>3.4.2</disruptor.version> <disruptor.version>3.4.2</disruptor.version>