public class ProgressableUtils extends Object
Modifier and Type | Method and Description |
---|---|
static void |
awaitChannelFuture(io.netty.channel.ChannelFuture future,
org.apache.hadoop.util.Progressable progressable)
Wait for
ChannelFuture to finish, while periodically
reporting progress. |
static void |
awaitChannelGroupFuture(io.netty.channel.group.ChannelGroupFuture future,
org.apache.hadoop.util.Progressable progressable)
Wait for
ChannelGroupFuture to finish, while periodically
reporting progress. |
static void |
awaitExecutorTermination(ExecutorService executor,
org.apache.hadoop.util.Progressable progressable)
Wait for executor tasks to terminate, while periodically reporting
progress.
|
static void |
awaitExecutorTermination(ExecutorService executor,
org.apache.hadoop.util.Progressable progressable,
int msecsPeriod)
Wait for executor tasks to terminate, while periodically reporting
progress.
|
static void |
awaitSemaphorePermits(Semaphore semaphore,
int permits,
org.apache.hadoop.util.Progressable progressable)
Wait to acquire enough permits from
Semaphore , while periodically
reporting progress. |
static void |
awaitTerminationFuture(io.netty.util.concurrent.EventExecutorGroup group,
org.apache.hadoop.util.Progressable progressable)
Wait for executorgroup to terminate, while periodically reporting progress
|
static <T> T |
getFutureResult(Future<T> future,
org.apache.hadoop.util.Progressable progressable)
Wait for the result of the future to be ready, while periodically
reporting progress.
|
static <R> List<R> |
getResultsWithNCallables(CallableFactory<R> callableFactory,
int numThreads,
String threadNameFormat,
org.apache.hadoop.util.Progressable progressable)
Create {#link numThreads} callables from {#link callableFactory},
execute them and gather results.
|
public static void awaitExecutorTermination(ExecutorService executor, org.apache.hadoop.util.Progressable progressable, int msecsPeriod)
executor
- Executor which we are waiting forprogressable
- Progressable for reporting progress (Job context)msecsPeriod
- How often to report progresspublic static void awaitExecutorTermination(ExecutorService executor, org.apache.hadoop.util.Progressable progressable)
executor
- Executor which we are waiting forprogressable
- Progressable for reporting progress (Job context)public static void awaitTerminationFuture(io.netty.util.concurrent.EventExecutorGroup group, org.apache.hadoop.util.Progressable progressable)
group
- ExecutorGroup whose termination we are awaitingprogressable
- Progressable for reporting progress (Job context)public static <T> T getFutureResult(Future<T> future, org.apache.hadoop.util.Progressable progressable)
T
- Type of the return value of the futurefuture
- Futureprogressable
- Progressable for reporting progress (Job context)public static void awaitChannelGroupFuture(io.netty.channel.group.ChannelGroupFuture future, org.apache.hadoop.util.Progressable progressable)
ChannelGroupFuture
to finish, while periodically
reporting progress.future
- ChannelGroupFutureprogressable
- Progressable for reporting progress (Job context)public static void awaitChannelFuture(io.netty.channel.ChannelFuture future, org.apache.hadoop.util.Progressable progressable)
ChannelFuture
to finish, while periodically
reporting progress.future
- ChannelFutureprogressable
- Progressable for reporting progress (Job context)public static void awaitSemaphorePermits(Semaphore semaphore, int permits, org.apache.hadoop.util.Progressable progressable)
Semaphore
, while periodically
reporting progress.semaphore
- Semaphorepermits
- How many permits to acquireprogressable
- Progressable for reporting progress (Job context)public static <R> List<R> getResultsWithNCallables(CallableFactory<R> callableFactory, int numThreads, String threadNameFormat, org.apache.hadoop.util.Progressable progressable)
R
- Type of Callable's resultscallableFactory
- Factory for CallablesnumThreads
- Number of threads to usethreadNameFormat
- Format for thread nameprogressable
- Progressable for reporting progressCopyright © 2011-2020 The Apache Software Foundation. All Rights Reserved.