命令中斷器
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 CommandInterrupter ()
公共方法
允許中斷
public void allowInterrupt ()
允許當前線程被中斷。
允許非同步中斷
publicallowInterruptAsync (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 |