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 ERROR(/ExecutorService) to run commands implemented as ShellCommandCallable, and use ERROR(/#joinFuture(String,Future,long)) for synchronization against the ERROR(/Future) as returned by ERROR(/ExecutorService) for the command execution.

Summary

Nested classes

class DeviceConcurrentUtil.ShellCommandCallable<V>

A ERROR(/Callable) that wraps the details of executing shell command on an ITestDevice

Public methods

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

Convenience method to join current thread on the task

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

Public methods

joinFuture

public static T joinFuture (String taskDesc, 
                 task, 
                long timeout)

Convenience method to join current thread on the task

DeviceNotAvailableException and ERROR(/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 : ERROR(/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
com.android.tradefed.device.DeviceNotAvailableException
DeviceNotAvailableException