DeviceConcurrentUtil

public class DeviceConcurrentUtil
extends Object

java.lang.Object
   ↳ com.android.tradefed.util.DeviceConcurrentUtil


Contains utility methods and classes for concurrent device side command execution

Use ExecutorService to run commands implemented as DeviceConcurrentUtil.ShellCommandCallable, and use joinFuture(String, Future, long) for synchronization against the Future as returned by ExecutorService for the command execution.

Summary

Nested classes

class DeviceConcurrentUtil.ShellCommandCallable<V>

A Callable that wraps the details of executing shell command on an ITestDevice

Public methods

static <T> T joinFuture(String taskDesc, Future<T> task, long timeout)

Convenience method to join current thread on the task

DeviceNotAvailableException and TimeoutException occurred during execution are passed through transparently, others are logged as error but not otherwise handled.

Public methods

joinFuture

T joinFuture (String taskDesc, 
                Future<T> task, 
                long timeout)

Convenience method to join current thread on the task

DeviceNotAvailableException and TimeoutException occurred during execution are passed through transparently, others are logged as error but not otherwise handled.

Parameters
taskDesc String: description of task for logging purpose

task Future: Future representing the task to join

timeout long: timeout for waiting on the task

Returns
T The result of the task with the template type.

Throws
DeviceNotAvailableException
TimeoutException
DeviceNotAvailableException