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

The following examples show how to use org.apache.hadoop.io.IOUtils#cleanupWithLogger() . These examples are extracted from open source projects. 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
/**
 * 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 Project: lucene-solr   File: DiskChecker.java    License: 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
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
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
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
@AfterClass
public static void shutdown() {
  if (cluster != null) {
    cluster.shutdown();
  }
  IOUtils.cleanupWithLogger(null, storageContainerLocationClient);
}
 
Example 7
@AfterClass
public static void shutdown() throws InterruptedException {
  if (cluster != null) {
    cluster.shutdown();
  }
  IOUtils.cleanupWithLogger(null, storageContainerLocationClient);
}
 
Example 8
@AfterClass
public static void shutdown() throws InterruptedException {
  if(cluster != null) {
    cluster.shutdown();
  }
  IOUtils.cleanupWithLogger(null, storageContainerLocationClient);
}
 
Example 9
@After
public void shutdown() {
  if (cluster != null) {
    cluster.shutdown();
  }
  IOUtils.cleanupWithLogger(null, storageContainerLocationClient);
}
 
Example 10
@AfterClass
public static void shutdown() throws InterruptedException {
  if (cluster != null) {
    cluster.shutdown();
  }
  IOUtils.cleanupWithLogger(null, storageContainerLocationClient);
}