Class ExecutorServiceFuturePool
java.lang.Object
org.apache.hadoop.fs.impl.prefetch.ExecutorServiceFuturePool
A FuturePool implementation backed by a java.util.concurrent.ExecutorService.
If a piece of work has started, it cannot (currently) be cancelled.
This class is a simplified version of
com.twitter:util-core_2.11
ExecutorServiceFuturePool designed to avoid depending on that Scala library.
One problem with using a Scala library is that many downstream projects
(eg Apache Spark) use Scala, and they might want to use a different version of Scala
from the version that Hadoop chooses to use.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidUtility to shutdown theExecutorServiceused by this class.toString()
-
Constructor Details
-
ExecutorServiceFuturePool
-
-
Method Details
-
executeFunction
- Parameters:
f- function to run in future on executor pool- Returns:
- future
- Throws:
RejectedExecutionException- can be thrownNullPointerException- if f param is null
-
executeRunnable
- Parameters:
r- runnable to run in future on executor pool- Returns:
- future
- Throws:
RejectedExecutionException- can be thrownNullPointerException- if r param is null
-
shutdown
Utility to shutdown theExecutorServiceused by this class. Will wait up to a certain timeout for the ExecutorService to gracefully shutdown.- Parameters:
logger- Loggertimeout- the maximum time to waitunit- the time unit of the timeout argument
-
toString
-