@Override protected AsyncWriter createWriterInstance(Path path) throws IOException { AsyncWriter localWriter = super.createWriterInstance(path); // retry forever if we can not create the remote writer to prevent aborting the RS due to log // rolling error, unless the skipRemoteWal is set to true. // TODO: since for now we only have one thread doing log rolling, this may block the rolling for // other wals Path remoteWAL = new Path(remoteWALDir, path.getName()); for (int retry = 0;; retry++) { if (skipRemoteWAL) { return localWriter; } AsyncWriter remoteWriter; try { remoteWriter = createAsyncWriter(remoteFs, remoteWAL); } catch (IOException e) { LOG.warn("create remote writer {} failed, retry = {}", remoteWAL, retry, e); try { Thread.sleep(ConnectionUtils.getPauseTime(100, retry)); } catch (InterruptedException ie) { // restore the interrupt state Thread.currentThread().interrupt(); Closeables.close(localWriter, true); throw (IOException) new InterruptedIOException().initCause(ie); } continue; } return createCombinedAsyncWriter(localWriter, remoteWriter); } }
@AfterClass public static void tearDownAfterClass() throws Exception { Closeables.close(ASYNC_CONN, true); TEST_UTIL.shutdownMiniCluster(); }
@AfterClass public static void tearDown() throws Exception { Closeables.close(CONN, true); TEST_UTIL.shutdownMiniCluster(); }
@AfterClass public static void tearDown() throws Exception { Closeables.close(CONN, true); UTIL.shutdownMiniCluster(); }
@AfterClass public static void tearDown() throws IOException { Closeables.close(ZKW, true); UTIL.shutdownMiniZKCluster(); UTIL.cleanupTestDir(); }
Closeables.close(scanner, true); scanners.forEach(KeyValueScanner::close);
Closeables.close(this.metricsRegionWrapper, true);
Closeables.close(scanner, true); if (!finished && writer != null) { abortWriter(writer);
Closeables.close(logRoller, true); try { if (region != null) {
/** * Closes the given {@link InputStream}, logging any {@code IOException} that's thrown rather than * propagating it. * * <p>While it's not safe in the general case to ignore exceptions that are thrown when closing an * I/O resource, it should generally be safe in the case of a resource that's being used only for * reading, such as an {@code InputStream}. Unlike with writable resources, there's no chance that * a failure that occurs when closing the stream indicates a meaningful problem such as a failure * to flush all bytes to the underlying resource. * * @param inputStream the input stream to be closed, or {@code null} in which case this method * does nothing * @since 17.0 */ public static void closeQuietly(@Nullable InputStream inputStream) { try { close(inputStream, true); } catch (IOException impossible) { throw new AssertionError(impossible); } }
/** * Closes the given {@link Reader}, logging any {@code IOException} that's thrown rather than * propagating it. * * <p>While it's not safe in the general case to ignore exceptions that are thrown when closing an * I/O resource, it should generally be safe in the case of a resource that's being used only for * reading, such as a {@code Reader}. Unlike with writable resources, there's no chance that a * failure that occurs when closing the reader indicates a meaningful problem such as a failure to * flush all bytes to the underlying resource. * * @param reader the reader to be closed, or {@code null} in which case this method does nothing * @since 17.0 */ public static void closeQuietly(@Nullable Reader reader) { try { close(reader, true); } catch (IOException impossible) { throw new AssertionError(impossible); } } }
@AfterClass public static void tearDown() throws Exception { Closeables.close(CONN, true); TEST_UTIL.shutdownMiniCluster(); }
@AfterClass public static void tearDown() throws IOException { Closeables.close(ZKW, true); UTIL.shutdownMiniZKCluster(); UTIL.cleanupTestDir(); }
@AfterClass public static void tearDown() throws IOException { Closeables.close(ZKW, true); UTIL.shutdownMiniZKCluster(); UTIL.cleanupTestDir(); }
Closeables.close(logRoller, true); try { if (region != null) {