命令中断器

public class CommandInterrupter
extends Object

java.lang.Object
com.android.tradefed.command.CommandInterrupter


允许 TradeFederation 命令被中断或标记为不可中断的服务。

概括

领域

public static final CommandInterrupter INSTANCE

辛格尔顿。

公共构造函数

CommandInterrupter ()

公共方法

void allowInterrupt ()

允许当前线程被中断。

allowInterruptAsync (Thread thread, long delay, TimeUnit unit)

允许指定线程在延迟后被中断。

void blockInterrupt ()

防止当前线程被中断。

void checkInterrupted ()

如果应该中断当前线程,则中断该线程。

void interrupt (Thread thread, String message, ErrorIdentifier errorId)

标记一个线程,并在它变得可中断时中断它。

boolean isInterruptible (Thread thread)
boolean isInterruptible ()

领域

实例

public static final CommandInterrupter INSTANCE

辛格尔顿。

公共构造函数

命令中断器

public CommandInterrupter ()

公共方法

允许中断

public void allowInterrupt ()

允许当前线程被中断。

允许异步中断

public  allowInterruptAsync (Thread thread, 
                long delay, 
                TimeUnit unit)

允许指定线程在延迟后被中断。

参数
thread Thread : 标记为可中断的线程

delay long : 从现在开始延迟执行的时间

unit TimeUnit : 延迟参数的时间单位

退货

块中断

public void blockInterrupt ()

防止当前线程被中断。

检查中断

public void checkInterrupted ()

如果应该中断当前线程,则中断该线程。鼓励线程定期调用此方法,以便抛出正确的RunInterruptedException

投掷
RunInterruptedException

打断

public void interrupt (Thread thread, 
                String message, 
                ErrorIdentifier errorId)

标记一个线程,并在它变得可中断时中断它。

参数
thread Thread : 标记为中断的线程

message String : 中断消息

errorId ErrorIdentifier

是可中断的

public boolean isInterruptible (Thread thread)

参数
thread Thread

退货
boolean true 如果指定线程是可中断的

是可中断的

public boolean isInterruptible ()

退货
boolean如果当前线程可中断则为 true