TracePropagatingExecutorService

public final class TracePropagatingExecutorService
extends Object

java.lang.Object
   ↳ com.android.tradefed.invoker.tracing.TracePropagatingExecutorService


An executor service that forwards tasks to an underlying implementation while propagating the tracing context.

This enables using tracing facilities such as CloseableTraceScope in submitted tasks.

Summary

Public methods

boolean awaitTermination(long timeout, TimeUnit unit)
static TracePropagatingExecutorService create(ExecutorService delegate)

Creates an ERROR(/ExecutorService) that delegates to the given delegate executor.

void execute(Runnable command)
<T> invokeAll( tasks, long timeout, TimeUnit unit)
<T> invokeAll( tasks)
<T> T invokeAny( tasks)
<T> T invokeAny( tasks, long timeout, TimeUnit unit)
boolean isShutdown()
boolean isTerminated()
void shutdown()
shutdownNow()
submit(Runnable task)
<T> submit(Runnable task, T result)
<T> submit( task)

Protected methods

<T> wrapTasks( tasks)

Public methods

awaitTermination

public boolean awaitTermination (long timeout, 
                TimeUnit unit)

Parameters
timeout long

unit TimeUnit

Returns
boolean

create

public static TracePropagatingExecutorService create (ExecutorService delegate)

Creates an ERROR(/ExecutorService) that delegates to the given delegate executor.

Note that the active trace on is that is propagated to tasks is the one active on calls to the executor method. This is done because TF constructs most objects before starting the invocation and attaching the trace.

Parameters
delegate ExecutorService

Returns
TracePropagatingExecutorService

execute

public void execute (Runnable command)

Parameters
command Runnable

invokeAll

public  invokeAll ( tasks, 
                long timeout, 
                TimeUnit unit)

Parameters
tasks

timeout long

unit TimeUnit

Returns

invokeAll

public  invokeAll ( tasks)

Parameters
tasks

Returns

invokeAny

public T invokeAny ( tasks)

Parameters
tasks

Returns
T

invokeAny

public T invokeAny ( tasks, 
                long timeout, 
                TimeUnit unit)

Parameters
tasks

timeout long

unit TimeUnit

Returns
T

isShutdown

public boolean isShutdown ()

Returns
boolean

isTerminated

public boolean isTerminated ()

Returns
boolean

shutdown

public void shutdown ()

shutdownNow

public  shutdownNow ()

Returns

submit

public  submit (Runnable task)

Parameters
task Runnable

Returns

submit

public  submit (Runnable task, 
                T result)

Parameters
task Runnable

result T

Returns

submit

public  submit ( task)

Parameters
task

Returns

Protected methods

wrapTasks

protected  wrapTasks ( tasks)

Parameters
tasks

Returns