CommandInterrupter

public class CommandInterrupter
extends Object

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


這項服務可中斷 TradeFederation 指令,或將指令標示為不可中斷。

摘要

欄位

public static final CommandInterrupter INSTANCE

Singleton。

公用建構函式

CommandInterrupter()

公用方法

void allowInterrupt()

允許中斷目前執行緒。

Future<?> allowInterruptAsync(Thread thread, long delay, TimeUnit unit)

允許在延遲後中斷指定執行緒。

void blockInterrupt()

防止目前執行緒遭到中斷。

void checkInterrupted()

Interrupts the current thread if it should be interrupted.

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

標記執行緒,在執行緒可中斷時中斷執行。

boolean isInterruptible(Thread thread)
boolean isInterruptible()

欄位

執行個體

public static final CommandInterrupter INSTANCE

單例模式。

公用建構函式

CommandInterrupter

public CommandInterrupter ()

公用方法

allowInterrupt

public void allowInterrupt ()

允許中斷目前執行緒。

allowInterruptAsync

public Future<?> allowInterruptAsync (Thread thread, 
                long delay, 
                TimeUnit unit)

允許在延遲後中斷指定執行緒。

參數
thread Thread:要標示為可中斷的執行緒

delay long:從現在開始延遲執行的時間

unit TimeUnit:延遲參數的時間單位

傳回
Future<?>

blockInterrupt

public void blockInterrupt ()

防止目前執行緒中斷。

checkInterrupted

public void checkInterrupted ()

如果應該中斷,則會中斷目前的執行緒。建議執行緒定期呼叫這個方法,以便擲回正確的 RunInterruptedException

擲回
RunInterruptedException

中斷

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

標記執行緒,在執行緒可中斷時中斷執行緒。

參數
thread Thread:要標示為中斷的執行緒

message String:中斷訊息

errorId ErrorIdentifier

isInterruptible

public boolean isInterruptible (Thread thread)

參數
thread Thread

傳回
boolean 如果指定執行緒可中斷,則為 true

isInterruptible

public boolean isInterruptible ()

傳回
boolean 如果目前的執行緒可中斷,則為 true