V - The time value that will be returned when the task is executed.public abstract class TimedRunnable<V> extends Object implements Runnable
| Constructor and Description |
|---|
TimedRunnable() |
| Modifier and Type | Method and Description |
|---|---|
protected abstract IOException |
convertToIOException(Exception e) |
long |
getThreadStart() |
long |
getTimeSpentNanos() |
V |
getValue() |
void |
run() |
static <V> List<V> |
run(String activity,
org.slf4j.Logger logger,
List<TimedRunnable<V>> runnables,
int parallelism)
Execute the list of runnables with the given parallelization.
|
protected abstract V |
runInner() |
protected abstract IOException convertToIOException(Exception e)
public long getThreadStart()
public long getTimeSpentNanos()
public final V getValue() throws IOException
IOExceptionpublic static <V> List<V> run(String activity, org.slf4j.Logger logger, List<TimedRunnable<V>> runnables, int parallelism) throws IOException
UserException is thrown.activity - Name of activity for reporting in logger.logger - The logger to use to report results.runnables - List of runnables that should be executed and timed. If this list has one item, task will be
completed in-thread. Runnable must handle InterruptedExceptions.parallelism - The number of threads that should be run to complete this task.IOException - All exceptions are coerced to IOException since this was build for storage system tasks initially.Copyright © 2017 The Apache Software Foundation. All rights reserved.