Java Code Examples for org.apache.hadoop.io.IOUtils#cleanupWithLogger()

The following examples show how to use org.apache.hadoop.io.IOUtils#cleanupWithLogger() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ReconStorageContainerManagerFacade.java    From hadoop-ozone with Apache License 2.0 6 votes vote down vote up
/**
 * Stop the Recon SCM subsystems.
 */
public void stop() {
  getDatanodeProtocolServer().stop();
  reconScmTasks.forEach(ReconScmTask::stop);
  try {
    LOG.info("Stopping SCM Event Queue.");
    eventQueue.close();
  } catch (Exception ex) {
    LOG.error("SCM Event Queue stop failed", ex);
  }
  IOUtils.cleanupWithLogger(LOG, nodeManager);
  IOUtils.cleanupWithLogger(LOG, containerManager);
  IOUtils.cleanupWithLogger(LOG, pipelineManager);
  try {
    dbStore.close();
  } catch (Exception e) {
    LOG.error("Can't close dbStore ", e);
  }
}
 
Example 2
Source File: DiskChecker.java    From lucene-solr with Apache License 2.0 6 votes vote down vote up
/**
 * Try to perform some disk IO by writing to the given file
 * without using Native IO.
 *
 * @param file file to check
 * @throws IOException if there was a non-retriable error.
 */
private static void diskIoCheckWithoutNativeIo(File file)
    throws IOException {
  FileOutputStream fos = null;

  try {
    final FileIoProvider provider = fileIoProvider.get();
    fos = provider.get(file);
    provider.write(fos, new byte[1]);
    fos.getFD().sync();
    fos.close();
    fos = null;
    if (!file.delete() && file.exists()) {
      throw new IOException("Failed to delete " + file);
    }
    file = null;
  } finally {
    IOUtils.cleanupWithLogger(log, fos);
    FileUtils.deleteQuietly(file);
  }
}
 
Example 3
Source File: SCMBlockProtocolServer.java    From hadoop-ozone with Apache License 2.0 5 votes vote down vote up
public void stop() {
  try {
    protocolMessageMetrics.unregister();
    LOG.info("Stopping the RPC server for Block Protocol");
    getBlockRpcServer().stop();
  } catch (Exception ex) {
    LOG.error("Block Protocol RPC stop failed.", ex);
  }
  IOUtils.cleanupWithLogger(LOG, scm.getScmNodeManager());
}
 
Example 4
Source File: SCMDatanodeProtocolServer.java    From hadoop-ozone with Apache License 2.0 5 votes vote down vote up
public void stop() {
  try {
    LOG.info("Stopping the RPC server for DataNodes");
    datanodeRpcServer.stop();
  } catch (Exception ex) {
    LOG.error(" datanodeRpcServer stop failed.", ex);
  }
  IOUtils.cleanupWithLogger(LOG, scm.getScmNodeManager());
  protocolMessageMetrics.unregister();
}
 
Example 5
Source File: SCMClientProtocolServer.java    From hadoop-ozone with Apache License 2.0 5 votes vote down vote up
public void stop() {
  protocolMetrics.unregister();
  try {
    LOG.info("Stopping the RPC server for Client Protocol");
    getClientRpcServer().stop();
  } catch (Exception ex) {
    LOG.error("Client Protocol RPC stop failed.", ex);
  }
  IOUtils.cleanupWithLogger(LOG, scm.getScmNodeManager());
}
 
Example 6
Source File: TestContainerStateMachineIdempotency.java    From hadoop-ozone with Apache License 2.0 5 votes vote down vote up
@AfterClass
public static void shutdown() {
  if (cluster != null) {
    cluster.shutdown();
  }
  IOUtils.cleanupWithLogger(null, storageContainerLocationClient);
}
 
Example 7
Source File: TestContainerSmallFile.java    From hadoop-ozone with Apache License 2.0 5 votes vote down vote up
@AfterClass
public static void shutdown() throws InterruptedException {
  if (cluster != null) {
    cluster.shutdown();
  }
  IOUtils.cleanupWithLogger(null, storageContainerLocationClient);
}
 
Example 8
Source File: TestAllocateContainer.java    From hadoop-ozone with Apache License 2.0 5 votes vote down vote up
@AfterClass
public static void shutdown() throws InterruptedException {
  if(cluster != null) {
    cluster.shutdown();
  }
  IOUtils.cleanupWithLogger(null, storageContainerLocationClient);
}
 
Example 9
Source File: TestXceiverClientManager.java    From hadoop-ozone with Apache License 2.0 5 votes vote down vote up
@After
public void shutdown() {
  if (cluster != null) {
    cluster.shutdown();
  }
  IOUtils.cleanupWithLogger(null, storageContainerLocationClient);
}
 
Example 10
Source File: TestGetCommittedBlockLengthAndPutKey.java    From hadoop-ozone with Apache License 2.0 5 votes vote down vote up
@AfterClass
public static void shutdown() throws InterruptedException {
  if (cluster != null) {
    cluster.shutdown();
  }
  IOUtils.cleanupWithLogger(null, storageContainerLocationClient);
}