命令中断器

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如果指定的线程是可中断的,则为真

是可中断的

public boolean isInterruptible ()

退货
boolean如果当前线程是可中断的则为真