TracePropagatingExecutorService
public
final
class
TracePropagatingExecutorService
extends Object
implements
ExecutorService
| java.lang.Object | |
| ↳ | com.android.tradefed.invoker.tracing.TracePropagatingExecutorService |
一种执行器服务,用于将任务转发给底层实现,同时传播跟踪记录上下文。
这样一来,您便可以在提交的任务中使用 CloseableTraceScope 等跟踪工具。
摘要
公共方法 | |
|---|---|
boolean
|
awaitTermination(long timeout, TimeUnit unit)
|
static
TracePropagatingExecutorService
|
create(ExecutorService delegate)
创建一个委托给指定委托执行器的 |
void
|
execute(Runnable command)
|
<T>
List<Future<T>>
|
invokeAll(Collection<? extends Callable<T>> tasks)
|
<T>
List<Future<T>>
|
invokeAll(Collection<? extends Callable<T>> tasks, long timeout, TimeUnit unit)
|
<T>
T
|
invokeAny(Collection<? extends Callable<T>> tasks)
|
<T>
T
|
invokeAny(Collection<? extends Callable<T>> tasks, long timeout, TimeUnit unit)
|
boolean
|
isShutdown()
|
boolean
|
isTerminated()
|
void
|
shutdown()
|
List<Runnable>
|
shutdownNow()
|
Future<?>
|
submit(Runnable task)
|
<T>
Future<T>
|
submit(Callable<T> task)
|
<T>
Future<T>
|
submit(Runnable task, T result)
|
受保护的方法 | |
|---|---|
<T>
Collection<? extends Callable<T>>
|
wrapTasks(Collection<? extends Callable<T>> tasks)
|
公共方法
awaitTermination
public boolean awaitTermination (long timeout,
TimeUnit unit)| 参数 | |
|---|---|
timeout |
long |
unit |
TimeUnit |
| 返回 | |
|---|---|
boolean |
|
| 抛出 | |
|---|---|
InterruptedException |
|
create
public static TracePropagatingExecutorService create (ExecutorService delegate)
创建委托给指定委托执行器的 ExecutorService。
请注意,传播到任务的有效轨迹是调用执行器方法时有效的轨迹。这是因为 TF 在开始调用和附加轨迹之前会构建大多数对象。
| 参数 | |
|---|---|
delegate |
ExecutorService |
| 返回 | |
|---|---|
TracePropagatingExecutorService |
|
execute
public void execute (Runnable command)
| 参数 | |
|---|---|
command |
Runnable |
invokeAll
public List<Future<T>> invokeAll (Collection<? extends Callable<T>> tasks)
| 参数 | |
|---|---|
tasks |
Collection |
| 返回 | |
|---|---|
List<Future<T>> |
|
| 抛出 | |
|---|---|
InterruptedException |
|
invokeAll
public List<Future<T>> invokeAll (Collection<? extends Callable<T>> tasks,
long timeout,
TimeUnit unit)| 参数 | |
|---|---|
tasks |
Collection |
timeout |
long |
unit |
TimeUnit |
| 返回 | |
|---|---|
List<Future<T>> |
|
| 抛出 | |
|---|---|
InterruptedException |
|
invokeAny
public T invokeAny (Collection<? extends Callable<T>> tasks)
| 参数 | |
|---|---|
tasks |
Collection |
| 返回 | |
|---|---|
T |
|
| 抛出 | |
|---|---|
ExecutionException |
|
InterruptedException |
|
invokeAny
public T invokeAny (Collection<? extends Callable<T>> tasks,
long timeout,
TimeUnit unit)| 参数 | |
|---|---|
tasks |
Collection |
timeout |
long |
unit |
TimeUnit |
| 返回 | |
|---|---|
T |
|
| 抛出 | |
|---|---|
ExecutionException |
|
InterruptedException |
|
TimeoutException |
|
isShutdown
public boolean isShutdown ()
| 返回 | |
|---|---|
boolean |
|
isTerminated
public boolean isTerminated ()
| 返回 | |
|---|---|
boolean |
|
关停
public void shutdown ()
shutdownNow
public List<Runnable> shutdownNow ()
| 返回 | |
|---|---|
List<Runnable> |
|
提交
public Future<?> submit (Runnable task)
| 参数 | |
|---|---|
task |
Runnable |
| 返回 | |
|---|---|
Future<?> |
|
提交
public Future<T> submit (Callable<T> task)
| 参数 | |
|---|---|
task |
Callable |
| 返回 | |
|---|---|
Future<T> |
|
提交
public Future<T> submit (Runnable task,
T result)| 参数 | |
|---|---|
task |
Runnable |
result |
T |
| 返回 | |
|---|---|
Future<T> |
|
受保护的方法
wrapTasks
protected Collection<? extends Callable<T>> wrapTasks (Collection<? extends Callable<T>> tasks)
| 参数 | |
|---|---|
tasks |
Collection |
| 返回值 | |
|---|---|
Collection<? extends Callable<T>> |
|