Class AsyncDiskService

java.lang.Object
org.apache.hadoop.util.AsyncDiskService

@LimitedPrivate({"HDFS","MapReduce"}) @Unstable public class AsyncDiskService extends Object
  • Field Details

    • LOG

      public static final org.slf4j.Logger LOG
  • Constructor Details

    • AsyncDiskService

      public AsyncDiskService(String[] volumes)
      Create a AsyncDiskServices with a set of volumes (specified by their root directories). The AsyncDiskServices uses one ThreadPool per volume to do the async disk operations.
      Parameters:
      volumes - The roots of the file system volumes.
  • Method Details

    • execute

      public void execute(String root, Runnable task)
      Execute the task sometime in the future, using ThreadPools.
      Parameters:
      root - root.
      task - task.
    • shutdown

      public void shutdown()
      Gracefully start the shut down of all ThreadPools.
    • awaitTermination

      public boolean awaitTermination(long milliseconds) throws InterruptedException
      Wait for the termination of the thread pools.
      Parameters:
      milliseconds - The number of milliseconds to wait
      Returns:
      true if all thread pools are terminated without time limit
      Throws:
      InterruptedException - if the thread is interrupted.
    • shutdownNow

      public List<Runnable> shutdownNow()
      Shut down all ThreadPools immediately.
      Returns:
      Runnable List.