命令中斷器

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如果當前線程是可中斷的則為真